configure method

  1. @protected
void configure()

Extension hook called by start just before the container is created.

Override in subclasses to inject additional configuration that depends on state set up after construction (for example, setting environment variables that are derived from constructor parameters).

The default implementation is a no-op. Subclasses in separate packages (e.g. a PostgresContainer) should @override this method and call withEnv / withExposedPorts / etc. before super.configure().

Example:

class PostgresContainer extends DockerContainer {
  PostgresContainer() : super('postgres:16');

  @override
  void configure() {
    withEnv('POSTGRES_PASSWORD', 'test');
    super.configure();
  }
}

Implementation

@protected
void configure() {}