public class RunService extends Object
| Constructor and Description |
|---|
RunService(DockerAccess docker,
QueryService queryService,
ContainerTracker tracker,
LogOutputSpecFactory logConfig,
Logger log) |
| Modifier and Type | Method and Description |
|---|---|
void |
addShutdownHookForStoppingContainers(boolean keepContainer,
boolean removeVolumes)
Add a shutdown hook in order to stop all registered containers
|
String |
createAndStartContainer(ImageConfiguration imageConfig,
PortMapping mappedPorts,
PomLabel pomLabel,
Properties mavenProps)
Create and start a container with the given image configuration.
|
String |
execInContainer(String containerId,
String command,
ImageConfiguration imageConfiguration)
Create and start a Exec container with the given image configuration.
|
List<StartOrderResolver.Resolvable> |
getImagesConfigsInOrder(QueryService queryService,
List<ImageConfiguration> images)
Get the proper order for images to start
|
PortMapping |
getPortMapping(RunImageConfiguration runConfig,
Properties properties)
Create port mapping for a specific configuration as it can be used when creating containers
|
String |
lookupContainer(String lookup)
Lookup a container that has been started
|
void |
stopContainer(String containerId,
ImageConfiguration imageConfig,
boolean keepContainer,
boolean removeVolumes)
Stop a container immediately by id.
|
void |
stopPreviouslyStartedContainer(String containerId,
boolean keepContainer,
boolean removeVolumes)
Lookup up whether a certain has been already started and registered.
|
void |
stopStartedContainers(boolean keepContainer,
boolean removeVolumes,
PomLabel pomLabel)
Stop all registered container
|
public RunService(DockerAccess docker, QueryService queryService, ContainerTracker tracker, LogOutputSpecFactory logConfig, Logger log)
public String execInContainer(String containerId, String command, ImageConfiguration imageConfiguration) throws DockerAccessException
containerId - container id to run exec command againstcommand - command to executeimageConfiguration - configuration of the container's imageDockerAccessException - if access to the docker backend failspublic String createAndStartContainer(ImageConfiguration imageConfig, PortMapping mappedPorts, PomLabel pomLabel, Properties mavenProps) throws DockerAccessException
imageConfig - image configuration holding the run information and the image namemappedPorts - container port mappingmavenProps - properties to fill in with dynamically assigned portspomLabel - label to tag the started container withDockerAccessException - if access to the docker backend failspublic void stopContainer(String containerId, ImageConfiguration imageConfig, boolean keepContainer, boolean removeVolumes) throws DockerAccessException
containerId - the container to stopimageConfig - image configuration for this containerkeepContainer - whether to keep container or to remove them after stoppingsremoveVolumes - whether to remove volumes after stoppingDockerAccessExceptionpublic void stopPreviouslyStartedContainer(String containerId, boolean keepContainer, boolean removeVolumes) throws DockerAccessException
containerId - the container to stopkeepContainer - whether to keep container or to remove them after stoppingsremoveVolumes - whether to remove volumes after stoppingDockerAccessExceptionpublic void stopStartedContainers(boolean keepContainer,
boolean removeVolumes,
PomLabel pomLabel)
throws DockerAccessException
keepContainer - whether to keep container or to remove them after stoppingsremoveVolumes - whether to remove volumes after stoppingDockerAccessException - if during stopping of a container sth failspublic String lookupContainer(String lookup)
lookup - a container by id or aliasnull otherwise.public List<StartOrderResolver.Resolvable> getImagesConfigsInOrder(QueryService queryService, List<ImageConfiguration> images)
images - list of images for which the order should be createdpublic PortMapping getPortMapping(RunImageConfiguration runConfig, Properties properties)
runConfig - the cun configurationproperties - properties to lookup variablespublic void addShutdownHookForStoppingContainers(boolean keepContainer,
boolean removeVolumes)
Copyright © 2016. All Rights Reserved.