public interface DockerClient extends Closeable
| Modifier and Type | Method and Description |
|---|---|
InputStream |
archiveContainer(String containerId,
String path)
Copies an archive out of a container.
|
LogStream |
attachContainer(String containerId,
DockerClient.AttachParameter... params)
Attach to the container id
|
int |
auth(AuthConfig authConfig)
Check auth configuration.
|
String |
build(Path directory,
DockerClient.BuildParam... params)
Build a docker image.
|
String |
build(Path directory,
ProgressHandler handler,
DockerClient.BuildParam... params)
Build a docker image.
|
String |
build(Path directory,
String name,
DockerClient.BuildParam... params)
Build a docker image.
|
String |
build(Path directory,
String name,
ProgressHandler handler,
DockerClient.BuildParam... params)
Build a docker image.
|
String |
build(Path directory,
String name,
String dockerfile,
ProgressHandler handler,
DockerClient.BuildParam... 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.
|
void |
connectToNetwork(String containerId,
String networkId)
Connects a docker container to a network.
|
InputStream |
copyContainer(String containerId,
String path)
Deprecated.
Replaced by
archiveContainer(String, String) in API 1.20, removed in 1.24. |
void |
copyToContainer(Path directory,
String containerId,
String path)
Copies some files from host to container.
|
void |
create(String image,
InputStream imagePayload)
Creates a single image from a tarball.
|
void |
create(String image,
InputStream imagePayload,
ProgressHandler handler)
Creates a single image from a tarball.
|
ContainerCreation |
createContainer(ContainerConfig config)
Create a docker container.
|
ContainerCreation |
createContainer(ContainerConfig config,
String name)
Create a docker container.
|
NetworkCreation |
createNetwork(NetworkConfig networkConfig)
Create a new network
|
ServiceCreateResponse |
createService(ServiceSpec spec)
Create a new service.
|
ServiceCreateResponse |
createService(ServiceSpec spec,
AuthConfig authConfig)
Create a new service.
|
Volume |
createVolume() |
Volume |
createVolume(Volume volume) |
void |
disconnectFromNetwork(String containerId,
String networkId)
Disconnects a docker container to a network.
|
EventStream |
events(DockerClient.EventsParam... params)
Watches the docker API for events.
|
ExecCreation |
execCreate(String containerId,
String[] cmd,
DockerClient.ExecCreateParam... params)
Sets up an exec instance in a running container id.
|
ExecState |
execInspect(String execId)
Inspects a running or previously run exec instance id.
|
void |
execResizeTty(String execId,
Integer height,
Integer width)
Resizes the tty session used by an exec command.
|
LogStream |
execStart(String execId,
DockerClient.ExecStartParameter... params)
Starts a previously set up exec instance id.
|
InputStream |
exportContainer(String containerId)
Export a docker container as a tar archive.
|
String |
getHost()
Get the Docker host address
|
List<ImageHistory> |
history(String image)
Return the history of the image.
|
Info |
info()
Get docker instance information.
|
ContainerInfo |
inspectContainer(String containerId)
Inspect a docker container.
|
List<ContainerChange> |
inspectContainerChanges(String containerId)
Inspect changes on a container's filesystem.
|
ImageInfo |
inspectImage(String image)
Inspect a docker container image.
|
Network |
inspectNetwork(String networkId)
Inspect a specific network
|
Service |
inspectService(String serviceId)
Inspect an existing service.
|
Swarm |
inspectSwarm()
Inspect the Swarm cluster.
|
Task |
inspectTask(String taskId)
Inspect an existing task.
|
Volume |
inspectVolume(String volumeName) |
void |
killContainer(String containerId)
Kill a docker container.
|
List<Container> |
listContainers(DockerClient.ListContainersParam... params)
List docker containers.
|
List<Image> |
listImages(DockerClient.ListImagesParam... params)
List docker images.
|
List<Network> |
listNetworks()
List all networks
|
List<Service> |
listServices()
List all services.
|
List<Service> |
listServices(Service.Criteria criteria)
List services that match the given criteria.
|
List<Task> |
listTasks()
List all tasks.
|
List<Task> |
listTasks(Task.Criteria criteria)
List tasks that match the given criteria.
|
VolumeList |
listVolumes(DockerClient.ListVolumesParam... params) |
void |
load(InputStream imagePayload)
Load a set of images and tags from a tarball.
|
void |
load(String image,
InputStream imagePayload)
Deprecated.
Use
load(InputStream) to load a set of image layers from a tarball. Use
create(String, InputStream) to create a single image from the contents of a tarball. |
void |
load(String image,
InputStream imagePayload,
AuthConfig authConfig)
Deprecated.
Use
load(InputStream) to load a set of image layers from a tarball. Use
create(String, InputStream) to create a single image from the contents of a tarball. |
void |
load(String image,
InputStream imagePayload,
AuthConfig authConfig,
ProgressHandler handler)
Deprecated.
Use
load(InputStream) to load a set of image layers from a tarball. Use
create(String, InputStream, ProgressHandler) to create a single image from the
contents of a tarball. |
void |
load(String image,
InputStream imagePayload,
ProgressHandler handler)
Deprecated.
Use
load(InputStream) to load a set of image layers from a tarball. Use
create(String, InputStream, ProgressHandler) to create a single image from the
contents of a tarball. |
LogStream |
logs(String containerId,
DockerClient.LogsParam... 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,
AuthConfig authConfig)
Pull a private docker container image.
|
void |
pull(String image,
AuthConfig authConfig,
ProgressHandler handler)
Pull a private docker container image, using a custom ProgressMessageHandler.
|
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,
AuthConfig authconfig) |
void |
push(String image,
ProgressHandler handler)
Push a docker container image, using a custom ProgressHandler
|
void |
push(String image,
ProgressHandler handler,
AuthConfig authConfig) |
void |
removeContainer(String containerId)
Remove a docker container.
|
void |
removeContainer(String containerId,
boolean removeVolumes)
Deprecated.
|
void |
removeContainer(String containerId,
DockerClient.RemoveContainerParam... params)
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 |
removeNetwork(String networkId)
Remove a docker network.
|
void |
removeService(String serviceId)
Remove an existing service.
|
void |
removeVolume(String volumeName) |
void |
removeVolume(Volume volume) |
void |
renameContainer(String containerId,
String name)
Rename a docker container.
|
void |
resizeTty(String containerId,
Integer height,
Integer width)
Resize container TTY
This API is valid only if
tty was specified as
part of creating the container. |
void |
restartContainer(String containerId)
Restart a docker container.
|
void |
restartContainer(String containerId,
int secondsToWaitBeforeRestart)
Restart a docker container.
|
InputStream |
save(String... images)
Get a tarball containing all images and metadata for the repository specified.
|
InputStream |
save(String image,
AuthConfig authConfig)
Deprecated.
AuthConfig is not required. Use
save(String...). |
InputStream |
saveMultiple(String... images)
Get a tarball containing all images and metadata for one or more repositories.
|
List<ImageSearchResult> |
searchImages(String term)
Search for images on Docker Hub
This method is broken for Docker 1.7.x because of a Docker bug.
|
void |
startContainer(String containerId)
Start a docker container.
|
ContainerStats |
stats(String containerId)
Retrieves one-time stats (stream=0) for the container with the specified id.
|
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 |
tag(String image,
String name,
boolean force)
Tag a docker image.
|
TopResults |
topContainer(String containerId)
List processes running inside the container by using
ps. |
TopResults |
topContainer(String containerId,
String psArgs)
List processes running inside the container using
ps and the given arguments. |
void |
unpauseContainer(String containerId)
Unpause a docker container.
|
void |
updateService(String serviceId,
Long version,
ServiceSpec spec)
Update an existing service.
|
Version |
version()
Get the docker version.
|
ContainerExit |
waitContainer(String containerId)
Wait for a docker container to exit.
|
String ping() throws DockerException, InterruptedException
DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedVersion version() throws DockerException, InterruptedException
DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedint auth(AuthConfig authConfig) throws DockerException, InterruptedException
authConfig - The authentication config needed to pull the image.DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedInfo info() throws DockerException, InterruptedException
DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedList<Container> listContainers(DockerClient.ListContainersParam... params) throws DockerException, InterruptedException
params - Container listing and filtering options.BadParamException - if one or more params were bad (400)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedList<Image> listImages(DockerClient.ListImagesParam... params) throws DockerException, InterruptedException
params - Image listing and filtering options.BadParamException - if one or more params were bad (400)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedContainerInfo inspectContainer(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to inspect.ContainerNotFoundException - if container was not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedContainerCreation 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.ContainerNotFoundException - if container was not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedImageInfo inspectImage(String image) throws DockerException, InterruptedException
image - The image to inspect.ImageNotFoundException - if image was not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedList<RemovedImage> removeImage(String image) throws DockerException, InterruptedException
image - The image to remove.ImageNotFoundException - if image was not found (404)ConflictException - conflict (409)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedList<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 image was not found (404)ConflictException - conflict (409)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedList<ImageSearchResult> searchImages(String term) throws DockerException, InterruptedException
term - the search termDockerException - if a server error occurred (500)InterruptedException - If the thread is interrupted@Deprecated void load(String image, InputStream imagePayload) throws DockerException, InterruptedException
load(InputStream) to load a set of image layers from a tarball. Use
create(String, InputStream) to create a single image from the contents of a tarball.image - the name to assign to the image.imagePayload - the image's payload (i.e.: the stream corresponding to the image's .tar
file).DockerException - if a server error occurred (500).InterruptedException - if the thread is interrupted.@Deprecated void load(String image, InputStream imagePayload, ProgressHandler handler) throws DockerException, InterruptedException
load(InputStream) to load a set of image layers from a tarball. Use
create(String, InputStream, ProgressHandler) to create a single image from the
contents of a tarball.image - the name to assign to the image.imagePayload - the image's payload (i.e.: the stream corresponding to the image's .tar
file).handler - The handler to use for processing each progress message received from
Docker.DockerException - if a server error occurred (500).InterruptedException - if the thread is interrupted.@Deprecated void load(String image, InputStream imagePayload, AuthConfig authConfig) throws DockerException, InterruptedException
load(InputStream) to load a set of image layers from a tarball. Use
create(String, InputStream) to create a single image from the contents of a tarball.image - the name to assign to the image.imagePayload - the image's payload (i.e.: the stream corresponding to the image's .tar
file).authConfig - The authentication config needed to pull the image.DockerException - if a server error occurred (500).InterruptedException - if the thread is interrupted.@Deprecated void load(String image, InputStream imagePayload, AuthConfig authConfig, ProgressHandler handler) throws DockerException, InterruptedException
load(InputStream) to load a set of image layers from a tarball. Use
create(String, InputStream, ProgressHandler) to create a single image from the
contents of a tarball.image - the name to assign to the image.imagePayload - the image's payload (i.e.: the stream corresponding to the image's .tar
file).authConfig - The authentication config needed to pull the image.handler - The handler to use for processing each progress message received from
Docker.DockerException - if a server error occurred (500).InterruptedException - if the thread is interrupted.void load(InputStream imagePayload) throws DockerException, InterruptedException
imagePayload - the image's payload (i.e.: the stream corresponding to the image's .tar
file).DockerException - if a server error occurred (500).InterruptedException - if the thread is interrupted.void create(String image, InputStream imagePayload) throws DockerException, InterruptedException
image - the name to assign to the image.imagePayload - the image's payload (i.e.: the stream corresponding to the image's .tar
file).DockerException - if a server error occurred (500).InterruptedException - if the thread is interrupted.void create(String image, InputStream imagePayload, ProgressHandler handler) throws DockerException, InterruptedException
image - the name to assign to the image.imagePayload - the image's payload (i.e.: the stream corresponding to the image's .tar
file).handler - The handler to use for processing each progress message received from
Docker.DockerException - if a server error occurred (500).InterruptedException - if the thread is interrupted.InputStream save(String... images) throws DockerException, IOException, InterruptedException
images - the name(s) of one or more images to save. If a specific name and tag
(e.g. ubuntu:latest), then only that image (and its parents) are returned.
If an image ID, similarly only that image (and its parents) are returned,
but with the exclusion of the 'repositories' file in the tarball,
as there were no image names referenced.DockerException - if a server error occurred (500).IOException - if the server started returning, but an I/O error occurred in the
context of processing it on the client-side.InterruptedException - if the thread is interrupted.@Deprecated InputStream save(String image, AuthConfig authConfig) throws DockerException, IOException, InterruptedException
save(String...).image - the name or id of the image to save. If a specific name and tag
(e.g. ubuntu:latest), then only that image (and its parents) are returned.
If an image ID, similarly only that image (and its parents) are returned,
but with the exclusion of the 'repositories' file in the tarball,
as there were no image names referenced.authConfig - The authentication config needed to pull the image.DockerException - if a server error occurred (500).IOException - if the server started returning, but an I/O error occurred in the
context of processing it on the client-side.InterruptedException - if the thread is interrupted.InputStream saveMultiple(String... images) throws DockerException, IOException, InterruptedException
images - the name or id of the image to save.
if it is a specific name and tag (e.g. ubuntu:latest), then only that image
(and its parents) are returned; if it is an image ID, similarly only that
image (and its parents) are returned and there would be no names referenced
in the 'repositories' file for this image ID.DockerException - if a server error occurred (500).IOException - if the server started returning, but an I/O error occurred in the
context of processing it on the client-side.InterruptedException - if the thread is interrupted.TopResults topContainer(String containerId) throws DockerException, InterruptedException
ps.containerId - the id of the container to examineDockerException - if a server error occurred (500).InterruptedException - if the thread is interrupted.TopResults topContainer(String containerId, String psArgs) throws DockerException, InterruptedException
ps and the given arguments.containerId - the id of the container to examinepsArgs - the arguments to pass to ps
inside the container, e.g., "-ef"DockerException - if a server error occurred (500).InterruptedException - if the thread is interrupted.void pull(String image) throws DockerException, InterruptedException
image - The image to pull.DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid 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.DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid pull(String image, AuthConfig authConfig) throws DockerException, InterruptedException
image - The image to pull.authConfig - The authentication config needed to pull the image.DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid pull(String image, AuthConfig authConfig, ProgressHandler handler) throws DockerException, InterruptedException
image - The image to pull.authConfig - The authentication config needed to pull the image.handler - The handler to use for processing each progress message received from
Docker.DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid push(String image) throws DockerException, InterruptedException
image - The image to push.DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid 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.DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid push(String image, AuthConfig authconfig) throws DockerException, InterruptedException
DockerExceptionInterruptedExceptionvoid push(String image, ProgressHandler handler, AuthConfig authConfig) throws DockerException, InterruptedException
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.BadParamException - if one or more params were bad (400)ImageNotFoundException - if image was not found (404)ConflictException - conflict (409)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid tag(String image, String name, boolean force) throws DockerException, InterruptedException
image - The image to tag.name - The new name that will be applied to the image.force - Whether to force the tagging even if the tag is already assigned to another
image.BadParamException - if one or more params were bad (400)ImageNotFoundException - if image was not found (404)ConflictException - conflict (409)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedString build(Path directory, DockerClient.BuildParam... params) throws DockerException, InterruptedException, IOException
directory - The directory containing the dockerfile.params - Additional flags to use during build.DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedIOException - If some IO shit happened.String build(Path directory, String name, DockerClient.BuildParam... 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.DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedIOException - If some IO shit happened.String build(Path directory, ProgressHandler handler, DockerClient.BuildParam... 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.DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedIOException - If some IO shit happened.String build(Path directory, String name, ProgressHandler handler, DockerClient.BuildParam... 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.DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedIOException - If some IO shit happened.String build(Path directory, String name, String dockerfile, ProgressHandler handler, DockerClient.BuildParam... params) throws DockerException, InterruptedException, IOException
directory - The directory containing the dockerfile.name - The repository name and optional tag to apply to the built image.dockerfile - The path within the build context to the Dockerfilehandler - The handler to use for processing each progress message received from
Docker.params - Additional flags to use during build.DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedIOException - If some IO shit happened.List<ImageHistory> history(String image) throws InterruptedException, DockerException
image - An image name or ID.ImageHistoryDockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedContainerCreation createContainer(ContainerConfig config) throws DockerException, InterruptedException
config - The container configuration.ImageNotFoundException - if the requested parent image was not found (404)DockerException - if logs cannot be attached, because container is not running (406),
or if a server error occurred (500)InterruptedException - If the thread is interruptedContainerCreation createContainer(ContainerConfig config, String name) throws DockerException, InterruptedException
config - The container configuration.name - The container name.ImageNotFoundException - if the requested parent image was not found (404)DockerException - if logs cannot be attached, because container is not running (406),
or if a server error occurred (500)InterruptedException - If the thread is interruptedvoid renameContainer(String containerId, String name) throws DockerException, InterruptedException
containerId - The id of the container to rename.name - The new name the container will haveContainerNotFoundException - if container cannot be found (404)ContainerRenameConflictException - if name is already assigned (409)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid startContainer(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to start.ContainerNotFoundException - if container is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid 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.ContainerNotFoundException - if container is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid pauseContainer(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to pause.ContainerNotFoundException - if container is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid unpauseContainer(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to pause.ContainerNotFoundException - if container is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid restartContainer(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to restart.ContainerNotFoundException - if container is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid 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 container is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedContainerExit waitContainer(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to wait for.ContainerNotFoundException - if container is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid killContainer(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to kill.ContainerNotFoundException - if container is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid removeContainer(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to remove.BadParamException - if one or more params were bad (400)ContainerNotFoundException - if container is not found (404)DockerException - If a server error occurred (500)InterruptedException - If the thread is interruptedvoid removeContainer(String containerId, DockerClient.RemoveContainerParam... params) throws DockerException, InterruptedException
containerId - The id of the container to remove.params - DockerClient.RemoveContainerParamBadParamException - if one or more params were bad (400)ContainerNotFoundException - if container is not found (404)DockerException - If a server error occurred (500)InterruptedException - If the thread is interrupted@Deprecated void removeContainer(String containerId, boolean removeVolumes) throws DockerException, InterruptedException
removeContainer(String, RemoveContainerParam...)containerId - The id of the container to remove.removeVolumes - Whether to remove volumes as well.BadParamException - if one or more params were bad (400)ContainerNotFoundException - if container is not found (404)DockerException - If a server error occurred (500)InterruptedException - If the thread is interruptedInputStream exportContainer(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to export.ContainerNotFoundException - if container is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interrupted@Deprecated InputStream copyContainer(String containerId, String path) throws DockerException, InterruptedException
archiveContainer(String, String) in API 1.20, removed in 1.24.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.ContainerNotFoundException - if container is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedUnsupportedApiVersionException - If client API is greater than or equal to 1.24InputStream archiveContainer(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.ContainerNotFoundException - if container is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid copyToContainer(Path directory, String containerId, String path) throws DockerException, InterruptedException, IOException
directory - The path to sent to containercontainerId - The id of the container to sent files.path - The path inside of the container to put files.BadParamException - if one or more params were bad (400)PermissionException - if the volume or container root file system is marked "read only"ContainerNotFoundException - if container is not found (404)DockerException - If a server error occurred (500)InterruptedException - If the thread is interruptedIOException - If IOExceptionList<ContainerChange> inspectContainerChanges(String containerId) throws DockerException, InterruptedException
containerId - The id of the container.ContainerNotFoundException - if container is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedLogStream logs(String containerId, DockerClient.LogsParam... 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.BadParamException - if one or more params were bad (400)ContainerNotFoundException - if container is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedEventStream events(DockerClient.EventsParam... params) throws DockerException, InterruptedException
params - The parameters to apply to the events requestDockerException - If a server error occurred (500)InterruptedException - If the thread is interruptedExecCreation execCreate(String containerId, String[] cmd, DockerClient.ExecCreateParam... params) throws DockerException, InterruptedException
containerId - The id of the containercmd - shell commandparams - Exec paramsExecCreationDockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedLogStream execStart(String execId, DockerClient.ExecStartParameter... params) throws DockerException, InterruptedException
execId - exec idparams - Exec start paramsExecNotFoundException - if exec instance is not found (404)ExecStartConflictException - if container is paused (409)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedSwarm inspectSwarm() throws DockerException, InterruptedException
DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedServiceCreateResponse createService(ServiceSpec spec) throws DockerException, InterruptedException
spec - the service specDockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedServiceCreateResponse createService(ServiceSpec spec, AuthConfig authConfig) throws DockerException, InterruptedException
spec - the service specconfig - the registry authentication configurationDockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedService inspectService(String serviceId) throws DockerException, InterruptedException
serviceId - the id of the service to inspectDockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid updateService(String serviceId, Long version, ServiceSpec spec) throws DockerException, InterruptedException
serviceId - the identifier of the serviceversion - the version of the servicespec - the new service specDockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedList<Service> listServices() throws DockerException, InterruptedException
DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedList<Service> listServices(Service.Criteria criteria) throws DockerException, InterruptedException
criteria - Service listing and filtering options.DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid removeService(String serviceId) throws DockerException, InterruptedException
serviceId - the id of the service to removeDockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedTask inspectTask(String taskId) throws DockerException, InterruptedException
taskId - the id of the task to inspectDockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedList<Task> listTasks() throws DockerException, InterruptedException
DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedList<Task> listTasks(Task.Criteria criteria) throws DockerException, InterruptedException
criteria - DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid execResizeTty(String execId, Integer height, Integer width) throws DockerException, InterruptedException
tty was specified as part
of creating and
starting the exec command.execId - exec idheight - height of tty sessionwidth - width of tty sessionBadParamException - if both height and width are null or zeroExecNotFoundException - if exec instance is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedExecState execInspect(String execId) throws DockerException, InterruptedException
execId - exec idExecNotFoundException - if exec instance is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedContainerStats stats(String containerId) throws DockerException, InterruptedException
containerId - The id of the container to retrieve stats for.ContainerNotFoundException - if container is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid resizeTty(String containerId, Integer height, Integer width) throws DockerException, InterruptedException
tty was specified as
part of creating the container.containerId - The id of the container whose TTY will be resized.height - New height of TTYwidth - New width of TTYBadParamException - if both height and width are null or zeroContainerNotFoundException - if container is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedList<Network> listNetworks() throws DockerException, InterruptedException
DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedNetwork inspectNetwork(String networkId) throws DockerException, InterruptedException
networkId - The id of the networkNetworkNotFoundException - if network is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedNetworkCreation createNetwork(NetworkConfig networkConfig) throws DockerException, InterruptedException
networkConfig - The network creation parametersNetworkNotFoundException - if network is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid removeNetwork(String networkId) throws DockerException, InterruptedException
networkId - The id of the network to remove.NetworkNotFoundException - if network is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid connectToNetwork(String containerId, String networkId) throws DockerException, InterruptedException
containerId - The id of the container to connect.networkId - The id of the network to connect.NotFoundException - if either container or network is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid disconnectFromNetwork(String containerId, String networkId) throws DockerException, InterruptedException
containerId - The id of the container to disconnect.networkId - The id of the network to disconnect.NotFoundException - if either container or network is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedvoid close()
close in interface AutoCloseableclose in interface CloseableLogStream attachContainer(String containerId, DockerClient.AttachParameter... 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.BadParamException - if one or more params were bad (400)ContainerNotFoundException - if container is not found (404)DockerException - if a server error occurred (500)InterruptedException - If the thread is interruptedString getHost()
Volume createVolume() throws DockerException, InterruptedException
DockerExceptionInterruptedExceptionVolume createVolume(Volume volume) throws DockerException, InterruptedException
DockerExceptionInterruptedExceptionVolume inspectVolume(String volumeName) throws DockerException, InterruptedException
DockerExceptionInterruptedExceptionvoid removeVolume(Volume volume) throws DockerException, InterruptedException
DockerExceptionInterruptedExceptionvoid removeVolume(String volumeName) throws DockerException, InterruptedException
DockerExceptionInterruptedExceptionVolumeList listVolumes(DockerClient.ListVolumesParam... params) throws DockerException, InterruptedException
DockerExceptionInterruptedExceptionCopyright © 2016. All rights reserved.