public class QueryService extends Object
| Constructor and Description |
|---|
QueryService(DockerAccess docker,
Logger log)
Constructor which gets its dependencies as args)
|
| Modifier and Type | Method and Description |
|---|---|
Container |
getContainer(String containerId)
Get container by id
|
Container |
getContainerByName(String containerName)
Get a container running for a given container name.
|
String |
getContainerName(String containerId)
Get name for single container when the id is given
|
List<Container> |
getContainersForImage(String image)
Get all containers which are build from an image.
|
String |
getImageId(String imageName)
Finds the id of an image.
|
Container |
getLatestContainerForImage(String image)
Get the id of the latest container started for an image
|
boolean |
hasContainer(String containerName)
Check whether a container with the given name exists
|
boolean |
hasImage(String name)
Check whether the given Image is locally available.
|
boolean |
imageRequiresAutoPull(String mode,
String imageName,
boolean always)
Check whether an image needs to be pulled.
|
public QueryService(DockerAccess docker, Logger log)
docker - remote access to docker daemonlog - loggerpublic Container getContainer(String containerId) throws DockerAccessException
containerId - idDockerAccessException - if an error occurs or no container with this id existspublic Container getContainerByName(String containerName) throws DockerAccessException
containerName - name of container to lookupnull if no container is available.DockerAccessException - in case of an remote errorpublic String getContainerName(String containerId) throws DockerAccessException
containerId - id of container to lookupDockerAccessException - if access to the docker daemon failspublic List<Container> getContainersForImage(String image) throws DockerAccessException
image - for which its container are looked upContainer objectsDockerAccessException - if the request failspublic String getImageId(String imageName) throws DockerAccessException
imageName - name of the image.DockerAccessException - if the request failspublic Container getLatestContainerForImage(String image) throws DockerAccessException
image - for which its container are looked upnull if no container has been started for this image.DockerAccessException - if the request failspublic boolean hasContainer(String containerName) throws DockerAccessException
containerName - container nameDockerAccessExceptionpublic boolean hasImage(String name) throws DockerAccessException
name - name of image to check, the image can contain a tag, otherwise 'latest' will be appendedDockerAccessException - if the request failspublic boolean imageRequiresAutoPull(String mode, String imageName, boolean always) throws DockerAccessException, org.apache.maven.plugin.MojoExecutionException
mode - the auto pull mode coming from the configurationimageName - name of the image to checkalways - whether to a alwaysPull mode would be active or is always ignoredDockerAccessExceptionorg.apache.maven.plugin.MojoExecutionExceptionCopyright © 2016. All Rights Reserved.