Interface DockerCompose
public interface DockerCompose
Provides a high-level API to work with Docker compose.
- Since:
- 3.1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DurationTimeout duration used to request a forced stop. -
Method Summary
Modifier and TypeMethodDescriptionvoidRundocker compose downto stop and remove any running services.voidRundocker compose downto stop and remove any running services.static DockerComposeget(DockerComposeFile file, @Nullable String hostname, Set<String> activeProfiles) Factory method used to create aDockerComposeinstance.static DockerComposeget(DockerComposeFile file, @Nullable String hostname, Set<String> activeProfiles, List<String> arguments) Factory method used to create aDockerComposeinstance.Return the running services for the active profile, or an empty list if no services are running.booleanReturn if services have been defined in theDockerComposeFilefor the active profiles.voidstart(org.springframework.boot.logging.LogLevel logLevel) Rundocker compose startto start services.voidRundocker compose startto start services.voidRundocker compose stopto stop any running services.voidRundocker compose stopto stop any running services.voidup(org.springframework.boot.logging.LogLevel logLevel) Rundocker compose upto create and start services.voidRundocker compose upto create and start services.
-
Field Details
-
FORCE_STOP
Timeout duration used to request a forced stop.
-
-
Method Details
-
up
void up(org.springframework.boot.logging.LogLevel logLevel) Rundocker compose upto create and start services. Waits until all contains are started and healthy.- Parameters:
logLevel- the log level used to report progress
-
up
Rundocker compose upto create and start services. Waits until all contains are started and healthy.- Parameters:
logLevel- the log level used to report progressarguments- the arguments to pass to the up command- Since:
- 3.4.0
-
down
Rundocker compose downto stop and remove any running services.- Parameters:
timeout- the amount of time to wait orFORCE_STOPto stop without waiting.
-
down
Rundocker compose downto stop and remove any running services.- Parameters:
timeout- the amount of time to wait orFORCE_STOPto stop without waiting.arguments- the arguments to pass to the down command- Since:
- 3.4.0
-
start
void start(org.springframework.boot.logging.LogLevel logLevel) Rundocker compose startto start services. Waits until all containers are started and healthy.- Parameters:
logLevel- the log level used to report progress
-
start
Rundocker compose startto start services. Waits until all containers are started and healthy.- Parameters:
logLevel- the log level used to report progressarguments- the arguments to pass to the start command- Since:
- 3.4.0
-
stop
Rundocker compose stopto stop any running services.- Parameters:
timeout- the amount of time to wait orFORCE_STOPto stop without waiting.
-
stop
Rundocker compose stopto stop any running services.- Parameters:
timeout- the amount of time to wait orFORCE_STOPto stop without waiting.arguments- the arguments to pass to the stop command- Since:
- 3.4.0
-
hasDefinedServices
boolean hasDefinedServices()Return if services have been defined in theDockerComposeFilefor the active profiles.- Returns:
trueif services have been defined- See Also:
-
getRunningServices
List<RunningService> getRunningServices()Return the running services for the active profile, or an empty list if no services are running.- Returns:
- the list of running services
-
get
static DockerCompose get(DockerComposeFile file, @Nullable String hostname, Set<String> activeProfiles) Factory method used to create aDockerComposeinstance.- Parameters:
file- the Docker Compose filehostname- the hostname used for services ornullif the hostname should be deducedactiveProfiles- a set of the profiles that should be activated- Returns:
- a
DockerComposeinstance
-
get
static DockerCompose get(DockerComposeFile file, @Nullable String hostname, Set<String> activeProfiles, List<String> arguments) Factory method used to create aDockerComposeinstance.- Parameters:
file- the Docker Compose filehostname- the hostname used for services ornullif the hostname should be deducedactiveProfiles- a set of the profiles that should be activatedarguments- the arguments to pass to Docker Compose- Returns:
- a
DockerComposeinstance - Since:
- 3.4.0
-