Package com.atlassian.bamboo.docker
Interface DockerContainerService
-
- All Known Implementing Classes:
DockerContainerServiceImpl
public interface DockerContainerService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable IntegergetHostPort(@NotNull ProcessContext processContext, @NotNull Path dockerPath, @NotNull String containerName, @NotNull Integer containerPort, @NotNull Path workingDirectory, @NotNull Map<String,String> environment)Gets the host port mapped to the given container port.booleanisRunning(@NotNull ProcessContext processContext, @NotNull Path dockerPath, @NotNull String containerName, @NotNull Path workingDirectory, @NotNull Map<String,String> environment)Checks if a container with the given name is running.voidremove(@NotNull ProcessContext processContext, @NotNull Path dockerPath, @NotNull String containerName, @NotNull Path workingDirectory, @NotNull Map<String,String> environment)Removes the container with the given name.voidrun(@NotNull ProcessContext processContext, @NotNull Path dockerPath, @NotNull String imageName, @NotNull RunConfig runConfig, @NotNull Path workingDirectory, @NotNull Map<String,String> environment)Start a Docker container for the image provided.
-
-
-
Method Detail
-
run
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 DockerExceptionStart a Docker container for the image provided.- Parameters:
imageName- the image to run.runConfig- The run configuration describing which parameters to include for the Docker run command.- Throws:
DockerException
-
isRunning
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 DockerExceptionChecks if a container with the given name is running. If the container exists but has exited, this method will return false.- Parameters:
containerName- the name of the container to check.- Returns:
- true if the container is running, false otherwise.
- Throws:
DockerException
-
getHostPort
@Nullable @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
Gets the host port mapped to the given container port.- 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
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 DockerExceptionRemoves the container with the given name. This method will forcibly remove the container if it is running.- Parameters:
containerName- the name of the container to remove.- Throws:
DockerException
-
-