Interface DockerCompose


public interface DockerCompose
Provides a high-level API to work with Docker compose.
Since:
3.1.0
Author:
Moritz Halbritter, Andy Wilkinson, Phillip Webb
  • Field Details

    • FORCE_STOP

      static final Duration FORCE_STOP
      Timeout duration used to request a forced stop.
  • Method Details

    • up

      void up(LogLevel logLevel)
      Run docker compose up to create and start services. Waits until all contains are started and healthy.
      Parameters:
      logLevel - the log level used to report progress
    • up

      void up(LogLevel logLevel, List<String> arguments)
      Run docker compose up to create and start services. Waits until all contains are started and healthy.
      Parameters:
      logLevel - the log level used to report progress
      arguments - the arguments to pass to the up command
      Since:
      3.4.0
    • down

      void down(Duration timeout)
      Run docker compose down to stop and remove any running services.
      Parameters:
      timeout - the amount of time to wait or FORCE_STOP to stop without waiting.
    • down

      void down(Duration timeout, List<String> arguments)
      Run docker compose down to stop and remove any running services.
      Parameters:
      timeout - the amount of time to wait or FORCE_STOP to stop without waiting.
      arguments - the arguments to pass to the down command
      Since:
      3.4.0
    • start

      void start(LogLevel logLevel)
      Run docker compose start to start services. Waits until all containers are started and healthy.
      Parameters:
      logLevel - the log level used to report progress
    • start

      void start(LogLevel logLevel, List<String> arguments)
      Run docker compose start to start services. Waits until all containers are started and healthy.
      Parameters:
      logLevel - the log level used to report progress
      arguments - the arguments to pass to the start command
      Since:
      3.4.0
    • stop

      void stop(Duration timeout)
      Run docker compose stop to stop any running services.
      Parameters:
      timeout - the amount of time to wait or FORCE_STOP to stop without waiting.
    • stop

      void stop(Duration timeout, List<String> arguments)
      Run docker compose stop to stop any running services.
      Parameters:
      timeout - the amount of time to wait or FORCE_STOP to 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 the DockerComposeFile for the active profiles.
      Returns:
      true if 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, String hostname, Set<String> activeProfiles)
      Factory method used to create a DockerCompose instance.
      Parameters:
      file - the Docker Compose file
      hostname - the hostname used for services or null if the hostname should be deduced
      activeProfiles - a set of the profiles that should be activated
      Returns:
      a DockerCompose instance
    • get

      static DockerCompose get(DockerComposeFile file, String hostname, Set<String> activeProfiles, List<String> arguments)
      Factory method used to create a DockerCompose instance.
      Parameters:
      file - the Docker Compose file
      hostname - the hostname used for services or null if the hostname should be deduced
      activeProfiles - a set of the profiles that should be activated
      arguments - the arguments to pass to Docker Compose
      Returns:
      a DockerCompose instance
      Since:
      3.4.0