public interface DockerAccess
| Modifier and Type | Method and Description |
|---|---|
void |
buildImage(String image,
File dockerArchive,
boolean forceRemove,
boolean noCache)
Create an docker image from a given archive
|
void |
copyArchive(String containerId,
File archive,
String targetPath)
Copy an archive (must be a tar) into a running container
Get all containers matching a certain label.
|
String |
createContainer(ContainerCreateConfig configuration,
String containerName)
Create a container from the given image.
|
String |
createExecContainer(String containerId,
Arguments arguments)
Sets up an exec instance for a running container id
|
String |
getImageId(String name)
Get the image id of a given name or
null if no such image exists |
LogGetHandle |
getLogAsync(String containerId,
LogCallback callback)
Get logs asynchronously.
|
void |
getLogSync(String containerId,
LogCallback callback)
Get logs for a container up to now synchronously.
|
boolean |
hasImage(String name)
Check whether the given name exists as image at the docker daemon
|
Container |
inspectContainer(String containerId)
Inspect a container
|
List<Container> |
listContainers(int limit)
List containers
|
void |
pullImage(String image,
AuthConfig authConfig,
String registry)
Pull an image from a remote registry and store it locally.
|
void |
pushImage(String image,
AuthConfig authConfig,
String registry)
Push an image to a registry.
|
void |
removeContainer(String containerId,
boolean removeVolumes)
Remove a container with the given id
|
boolean |
removeImage(String image,
boolean... force)
Remove an image from this docker installation
|
void |
shutdown()
Lifecycle method which must be called when this object is not needed anymore.
|
void |
start()
Lifecycle method for this access class which must be called before any other method is called.
|
void |
startContainer(String containerId)
Start a container.
|
void |
startExecContainer(String containerId,
LogOutputSpec outputSpec)
Starts a previously set up exec instance id.
|
void |
stopContainer(String containerId,
int killWait)
Stop a container.
|
void |
tag(String sourceImage,
String targetImage,
boolean force)
Alias an image in the repository with a complete new name.
|
Container inspectContainer(String containerId) throws DockerAccessException
containerId - container idContainerDetails representing the containerDockerAccessException - if the container could not be inspectedboolean hasImage(String name) throws DockerAccessException
name - image name to checkDockerAccessExceptionString getImageId(String name) throws DockerAccessException
null if no such image existsname - name to lookupnullDockerAccessExceptionList<Container> listContainers(int limit) throws DockerAccessException
limit - limit of containers to listContainer objectsDockerAccessException - if the containers could not be listedvoid startExecContainer(String containerId, LogOutputSpec outputSpec) throws DockerAccessException
containerId - id of the exec containeroutputSpec - how to print out the output of the commandDockerAccessException - if the container could not be created.String createExecContainer(String containerId, Arguments arguments) throws DockerAccessException
containerId - id of the running container which the exec container will be created forarguments - container exec commands to runDockerAccessException - if the container could not be created.String createContainer(ContainerCreateConfig configuration, String containerName) throws DockerAccessException
The container id will be set on the container upon successful creation.
configuration - container configurationcontainerName - name container should be created with or null for a docker provided nameDockerAccessException - if the container could not be created.void startContainer(String containerId) throws DockerAccessException
containerId - id of the container to startDockerAccessException - if the container could not be started.void stopContainer(String containerId, int killWait) throws DockerAccessException
containerId - the container idkillWait - the time to wait between stop and kill (in seconds)DockerAccessException - if the container could not be stopped.void copyArchive(String containerId, File archive, String targetPath) throws DockerAccessException
containerId - container to copy intoarchive - local archive to copy intotargetPath - target path to useDockerAccessExceptionvoid getLogSync(String containerId, LogCallback callback)
containerId - container idcallback - which is called for each line receivedLogGetHandle getLogAsync(String containerId, LogCallback callback)
containerId - id of the container for which to fetch the logscallback - to call when log data arrivesvoid removeContainer(String containerId, boolean removeVolumes) throws DockerAccessException
containerId - container id for the container to removeremoveVolumes - if true, will remove any volumes associated to containerDockerAccessException - if the container couldn't be removed.void pullImage(String image, AuthConfig authConfig, String registry) throws DockerAccessException
image - the image to pull.authConfig - authentication configuration used when pulling an imageregistry - an optional registry from where to pull the image. Can be null.DockerAccessException - if the image couldn't be pulled.void pushImage(String image, AuthConfig authConfig, String registry) throws DockerAccessException
image - image name to pushauthConfig - authentication configurationregistry - optional registry to which the image should be pushed.DockerAccessException - in case pushing failsvoid buildImage(String image, File dockerArchive, boolean forceRemove, boolean noCache) throws DockerAccessException
image - name of the image to build or null if none should be useddockerArchive - from which the docker image should be buildforceRemove - whether to remove intermediate containersnoCache - whether to use cache when building the imageDockerAccessException - if docker host reports an error during building of an imagevoid tag(String sourceImage, String targetImage, boolean force) throws DockerAccessException
sourceImage - full name (including tag) of the image to aliastargetImage - the alias nameforce - forced taggingDockerAccessException - if the original image doesn't exist or another error occurs somehow.boolean removeImage(String image, boolean... force) throws DockerAccessException
image - image to removeforce - if set to true remove containers as well (only the first vararg is evaluated)DockerAccessException - if an image cannot be removedvoid start()
throws DockerAccessException
DockerAccessExceptionvoid shutdown()
Copyright © 2016. All Rights Reserved.