public interface DockerClient extends Closeable
| Modifier and Type | Interface and Description |
|---|---|
static class |
DockerClient.BuildParameter
Flags which can be passed to the
build method. |
static class |
DockerClient.ListContainersParam
Parameters for
listContainers(ListContainersParam...) |
static class |
DockerClient.ListImagesFilterParam
Filter parameter for
listImages(ListImagesParam...). |
static class |
DockerClient.ListImagesParam
Parameters for
listImages(ListImagesParam...) |
static class |
DockerClient.LogsParameter
Parameters for
logs(String, LogsParameter...) |
| Modifier and Type | Method and Description |
|---|---|
String |
build(Path directory,
DockerClient.BuildParameter... params)
Build a docker image.
|
String |
build(Path directory,
ProgressHandler handler,
DockerClient.BuildParameter... params)
Build a docker image.
|
String |
build(Path directory,
String name,
DockerClient.BuildParameter... params)
Build a docker image.
|
String |
build(Path directory,
String name,
ProgressHandler handler,
DockerClient.BuildParameter... params)
Build a docker image.
|
void |
close()
Closes any and all underlying connections to docker, and release resources.
|
ContainerCreation |
commitContainer(String containerId,
String repo,
String tag,
ContainerConfig config,
String comment,
String author)
Create a new image from a container's changes.
|
InputStream |
copyContainer(String containerId,
String path)
Copies some files out of a container.
|
ContainerCreation |
createContainer(ContainerConfig config)
Create a docker container.
|
ContainerCreation |
createContainer(ContainerConfig config,
String name)
Create a docker container.
|
InputStream |
exportContainer(String containerId)
Export a docker container as a tar archive.
|
Info |
info()
Get docker instance information.
|
ContainerInfo |
inspectContainer(String containerId)
Inspect a docker container.
|
ImageInfo |
inspectImage(String image)
Inspect a docker container image.
|
void |
killContainer(String containerId)
Kill a docker container.
|
List<Container> |
listContainers(DockerClient.ListContainersParam... params)
List docker containers.
|
List<Image> |
listImages(DockerClient.ListImagesParam... params) |
LogStream |
logs(String containerId,
DockerClient.LogsParameter... params)
Get docker container logs.
|
void |
pauseContainer(String containerId)
Pause a docker container.
|
String |
ping()
Ping the docker daemon.
|
void |
pull(String image)
Pull a docker container image.
|
void |
pull(String image,
ProgressHandler handler)
Pull a docker container image, using a custom ProgressMessageHandler
|
void |
push(String image)
Push a docker container image.
|
void |
push(String image,
ProgressHandler handler)
Push a docker container image, using a custom ProgressHandler
|
void |
removeContainer(String containerId)
Remove a docker container.
|
void |
removeContainer(String containerId,
boolean removeVolumes)
Remove a docker container.
|
List<RemovedImage> |
removeImage(String image)
Remove a docker image.
|
List<RemovedImage> |
removeImage(String image,
boolean force,
boolean noPrune)
Remove a docker image.
|
void |
restartContainer(String containerId)
Restart a docker container.
|
void |
restartContainer(String containerId,
int secondsToWaitBeforeRestart)
Restart a docker container.
|
void |
startContainer(String containerId)
Start a docker container.
|
void |
startContainer(String containerId,
HostConfig hostConfig)
Start a docker container.
|
void |
stopContainer(String containerId,
int secondsToWaitBeforeKilling)
Stop a docker container by sending a SIGTERM, and following up with a SIGKILL if the
container doesn't exit gracefully and in a timely manner.
|
void |
tag(String image,
String name)
Tag a docker image.
|
void |
unpauseContainer(String containerId)
Unpause a docker container.
|
Version |
version()
Get the docker version.
|
ContainerExit |
waitContainer(String containerId)
Wait for a docker container to exit.
|
String ping() throws DockerException, InterruptedException
DockerExceptionInterruptedExceptionVersion version() throws DockerException, InterruptedException
DockerExceptionInterruptedExceptionInfo info() throws DockerException, InterruptedException
DockerExceptionInterruptedExceptionList<Container> listContainers(DockerClient.ListContainersParam... params) throws DockerException, InterruptedException
params - Container listing and filtering options.DockerExceptionInterruptedExceptionList<Image> listImages(DockerClient.ListImagesParam... params) throws DockerException, InterruptedException
DockerExceptionInterruptedExceptionContainerInfo inspectContainer(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to inspect.ContainerNotFoundException - if the container was not found (404).DockerExceptionInterruptedExceptionContainerCreation commitContainer(String containerId, String repo, String tag, ContainerConfig config, String comment, String author) throws DockerException, InterruptedException
containerId - The id of the container to commit.comment - commit message.author - image author.tag - image tag.repo - repository to commit to.config - ContainerConfig to commit.DockerExceptionInterruptedExceptionImageInfo inspectImage(String image) throws DockerException, InterruptedException
image - The image to inspect.ImageNotFoundException - if the image was not found (404).DockerExceptionInterruptedExceptionList<RemovedImage> removeImage(String image) throws DockerException, InterruptedException
image - The image to remove.ImageNotFoundException - if the image was not found (404).DockerExceptionInterruptedExceptionList<RemovedImage> removeImage(String image, boolean force, boolean noPrune) throws DockerException, InterruptedException
image - The image to remove.force - Force image removal.noPrune - Do not delete untagged parents.ImageNotFoundException - if the image was not found (404).DockerExceptionInterruptedExceptionvoid pull(String image) throws DockerException, InterruptedException
image - The image to pull.DockerExceptionInterruptedExceptionvoid pull(String image, ProgressHandler handler) throws DockerException, InterruptedException
image - The image to pull.handler - The handler to use for processing each progress message received from Docker.DockerExceptionInterruptedExceptionvoid push(String image) throws DockerException, InterruptedException
image - The image to push.DockerExceptionInterruptedExceptionvoid push(String image, ProgressHandler handler) throws DockerException, InterruptedException
image - The image to push.handler - The handler to use for processing each progress message received from Docker.DockerExceptionInterruptedExceptionvoid tag(String image, String name) throws DockerException, InterruptedException
image - The image to tag.name - The new name that will be applied to the image.DockerExceptionInterruptedExceptionString build(Path directory, DockerClient.BuildParameter... params) throws DockerException, InterruptedException, IOException
directory - The directory containing the dockerfile.params - Additional flags to use during build.DockerExceptionInterruptedExceptionIOExceptionString build(Path directory, String name, DockerClient.BuildParameter... params) throws DockerException, InterruptedException, IOException
directory - The directory containing the dockerfile.name - The repository name and optional tag to apply to the built image.params - Additional flags to use during build.DockerExceptionInterruptedExceptionIOExceptionString build(Path directory, ProgressHandler handler, DockerClient.BuildParameter... params) throws DockerException, InterruptedException, IOException
directory - The directory containing the dockerfile.handler - The handler to use for processing each progress message received from Docker.params - Additional flags to use during build.DockerExceptionInterruptedExceptionIOExceptionString build(Path directory, String name, ProgressHandler handler, DockerClient.BuildParameter... params) throws DockerException, InterruptedException, IOException
directory - The directory containing the dockerfile.name - The repository name and optional tag to apply to the built image.handler - The handler to use for processing each progress message received from Docker.params - Additional flags to use during build.DockerExceptionInterruptedExceptionIOExceptionContainerCreation createContainer(ContainerConfig config) throws DockerException, InterruptedException
config - The container configuration.ImageNotFoundException - if the image was not found (404).DockerExceptionInterruptedExceptionContainerCreation createContainer(ContainerConfig config, String name) throws DockerException, InterruptedException
config - The container configuration.name - The container name.ImageNotFoundException - if the image was not found (404).DockerExceptionInterruptedExceptionvoid startContainer(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to start.ContainerNotFoundException - if the container was not found (404).DockerExceptionInterruptedExceptionvoid startContainer(String containerId, HostConfig hostConfig) throws DockerException, InterruptedException
containerId - The id of the container to start.hostConfig - The docker host configuration to use when starting the container.ContainerNotFoundException - if the container was not found (404).DockerExceptionInterruptedExceptionvoid stopContainer(String containerId, int secondsToWaitBeforeKilling) throws DockerException, InterruptedException
containerId - The id of the container to stop.secondsToWaitBeforeKilling - Time to wait after SIGTERM before sending SIGKILL.DockerExceptionInterruptedExceptionvoid pauseContainer(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to pause.ContainerNotFoundException - if the container was not found (404).DockerExceptionInterruptedExceptionvoid unpauseContainer(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to pause.ContainerNotFoundException - if the container was not found (404).DockerExceptionInterruptedExceptionvoid restartContainer(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to restart.ContainerNotFoundException - if the container was not found (404).DockerExceptionInterruptedExceptionvoid restartContainer(String containerId, int secondsToWaitBeforeRestart) throws DockerException, InterruptedException
containerId - The id of the container to restart.secondsToWaitBeforeRestart - number of seconds to wait before killing the container.ContainerNotFoundException - if the container was not found (404).DockerExceptionInterruptedExceptionContainerExit waitContainer(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to wait for.ContainerNotFoundException - if the container was not found (404).DockerExceptionInterruptedExceptionvoid killContainer(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to kill.ContainerNotFoundException - if the container was not found (404).DockerExceptionInterruptedExceptionvoid removeContainer(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to remove.ContainerNotFoundException - if the container was not found (404).DockerExceptionInterruptedExceptionvoid removeContainer(String containerId, boolean removeVolumes) throws DockerException, InterruptedException
containerId - The id of the container to remove.removeVolumes - Whether to remove volumes as well.ContainerNotFoundException - if the container was not found (404).DockerExceptionInterruptedExceptionInputStream exportContainer(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to export.DockerExceptionInterruptedExceptionInputStream copyContainer(String containerId, String path) throws DockerException, InterruptedException
containerId - The id of the container to copy files from.path - The path inside of the container to copy. If this is a directory, it will
be copied recursively. If this is a file, only that file will be copied.copy(..., "/usr/share") will
result in a directory called share in the tar archive). The directory name is
completely resolved, so copying "/usr/share/././." will still create a directory called
"share" in the tar archive. If a single file was copied, that file will be the sole
entry in the tar archive. Copying "." or equivalently "/" will result in the
tar archive containing a single folder named after the container ID.DockerExceptionInterruptedExceptionLogStream logs(String containerId, DockerClient.LogsParameter... params) throws DockerException, InterruptedException
containerId - The id of the container to get logs for.params - Params for controlling what streams to get and whether to tail or not.ContainerNotFoundException - if the container was not found (404).DockerExceptionInterruptedExceptionvoid close()
close in interface AutoCloseableclose in interface CloseableCopyright © 2014. All rights reserved.