DockerContainerConfig class final

What a container is made of, as the daemon's POST /containers/create takes it.

GenericContainer fills it from its fluent methods; use it directly with DockerClient.createContainer for what they do not cover.

Testcontainers (Java): the CreateContainerCmd of docker-java.

Constructors

DockerContainerConfig({required String image, Map<String, String> environment = const {}, List<String>? command, List<String>? entrypoint, List<int> exposedPorts = const [], Map<String, String> labels = const {}, List<String> binds = const [], bool autoRemove = false, String publishIp = '', ({Duration interval, int retries, List<String> test, Duration timeout})? healthCheck})
A container of image; every other setting is optional.
const

Properties

autoRemove → bool
Whether the daemon removes the container when it exits.
final
binds → List<String>
Bind mounts, as /host/path:/container/path[:ro].
final
command → List<String>?
The command (CMD), or null for the image's own.
final
entrypoint → List<String>?
The entry point, or null for the image's own.
final
environment → Map<String, String>
Environment variables, by name.
final
exposedPorts → List<int>
The container ports to publish, each on a random free host port (read them back with DockerContainerState.mappedPort).
final
hashCode → int
The hash code for this object.
no setterinherited
healthCheck → ({Duration interval, int retries, List<String> test, Duration timeout})?
A health check of the container's own, replacing the image's: the command in exec form (['CMD-SHELL', 'pg_isready']) and how often it runs, how long it may take and how many failures make the container unhealthy.
final
image → String
The image, such as postgres:17.
final
labels → Map<String, String>
Labels, by name.
final
publishIp → String
The host interface the ports are published on; empty is all of them.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, Object?>
The JSON body of the create request.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited