Class DockerContainerServiceImpl

java.lang.Object
com.atlassian.bamboo.docker.DockerContainerServiceImpl
All Implemented Interfaces:
DockerContainerService

public class DockerContainerServiceImpl extends Object implements DockerContainerService
  • Field Details

  • Constructor Details

    • DockerContainerServiceImpl

      public DockerContainerServiceImpl()
  • Method Details

    • run

      public void run(@NotNull @NotNull ProcessContext processContext, @NotNull @NotNull Path dockerPath, @NotNull @NotNull String imageName, @NotNull @NotNull RunConfig runConfig, @NotNull @NotNull Path workingDirectory, @NotNull @NotNull Map<String,String> environment) throws DockerException
      Description copied from interface: DockerContainerService
      Start a Docker container for the image provided.
      Specified by:
      run in interface DockerContainerService
      Parameters:
      imageName - the image to run.
      runConfig - The run configuration describing which parameters to include for the Docker run command.
      Throws:
      DockerException
    • isRunning

      public boolean isRunning(@NotNull @NotNull ProcessContext processContext, @NotNull @NotNull Path dockerPath, @NotNull @NotNull String containerName, @NotNull @NotNull Path workingDirectory, @NotNull @NotNull Map<String,String> environment) throws DockerException
      Description copied from interface: DockerContainerService
      Checks if a container with the given name is running. If the container exists but has exited, this method will return false.
      Specified by:
      isRunning in interface DockerContainerService
      Parameters:
      containerName - the name of the container to check.
      Returns:
      true if the container is running, false otherwise.
      Throws:
      DockerException
    • getHostPort

      @Nullable public @Nullable Integer getHostPort(@NotNull @NotNull ProcessContext processContext, @NotNull @NotNull Path dockerPath, @NotNull @NotNull String containerName, @NotNull @NotNull Integer containerPort, @NotNull @NotNull Path workingDirectory, @NotNull @NotNull Map<String,String> environment) throws DockerException
      Description copied from interface: DockerContainerService
      Gets the host port mapped to the given container port.
      Specified by:
      getHostPort in interface DockerContainerService
      Parameters:
      containerName - the name of the container to check.
      containerPort - The container port.
      Returns:
      The host port or null if there is no host port mapped to the container port.
      Throws:
      DockerException
    • remove

      public void remove(@NotNull @NotNull ProcessContext processContext, @NotNull @NotNull Path dockerPath, @NotNull @NotNull String containerName, @NotNull @NotNull Path workingDirectory, @NotNull @NotNull Map<String,String> environment) throws DockerException
      Description copied from interface: DockerContainerService
      Removes the container with the given name. This method will forcibly remove the container if it is running.
      Specified by:
      remove in interface DockerContainerService
      Parameters:
      containerName - the name of the container to remove.
      Throws:
      DockerException