Package com.spotify.docker.client
Class DefaultDockerClient
- java.lang.Object
-
- com.spotify.docker.client.DefaultDockerClient
-
- All Implemented Interfaces:
DockerClient,java.io.Closeable,java.lang.AutoCloseable
public class DefaultDockerClient extends java.lang.Object implements DockerClient, java.io.Closeable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefaultDockerClient.Builderprivate static classDefaultDockerClient.BuildProgressHandlerHack: thisProgressHandleris meant to capture the image ID of an image being built.private static classDefaultDockerClient.CreateProgressHandlerHack: thisProgressHandleris meant to capture the image ID (or image digest in Docker 1.10+) of an image being created.private static classDefaultDockerClient.LoadProgressHandlerHack: thisProgressHandleris meant to capture the image names of an image being loaded.private static classDefaultDockerClient.ResponseTailReader-
Nested classes/interfaces inherited from interface com.spotify.docker.client.DockerClient
DockerClient.AttachParameter, DockerClient.BuildParam, DockerClient.EventsFilterParam, DockerClient.EventsParam, DockerClient.ExecCreateParam, DockerClient.ExecStartParameter, DockerClient.FilterParam, DockerClient.ListContainersFilterParam, DockerClient.ListContainersParam, DockerClient.ListImagesFilterParam, DockerClient.ListImagesParam, DockerClient.ListNetworksFilterParam, DockerClient.ListNetworksParam, DockerClient.ListVolumesFilterParam, DockerClient.ListVolumesParam, DockerClient.LogsParam, DockerClient.Param, DockerClient.RemoveContainerParam, DockerClient.Signal
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringapiVersionprivate javax.ws.rs.client.Clientclientprivate static javax.ws.rs.core.GenericType<java.util.List<Config>>CONFIG_LISTprivate static javax.ws.rs.core.GenericType<java.util.List<ContainerChange>>CONTAINER_CHANGE_LISTprivate static javax.ws.rs.core.GenericType<java.util.List<Container>>CONTAINER_LISTprivate static java.util.regex.PatternCONTAINER_NAME_PATTERNprivate static longDEFAULT_CONNECT_TIMEOUT_MILLISprivate static intDEFAULT_CONNECTION_POOL_SIZEprivate static longDEFAULT_READ_TIMEOUT_MILLISprivate org.glassfish.jersey.client.ClientConfigdefaultConfigprivate static javax.ws.rs.core.GenericType<Distribution>DISTRIBUTIONprivate java.util.Map<java.lang.String,java.lang.Object>headersprivate static javax.ws.rs.core.GenericType<java.util.List<ImageHistory>>IMAGE_HISTORY_LISTprivate static javax.ws.rs.core.GenericType<java.util.List<Image>>IMAGE_LISTprivate static javax.ws.rs.core.GenericType<java.util.List<ImageSearchResult>>IMAGES_SEARCH_RESULT_LISTprivate static org.slf4j.Loggerlogprivate static javax.ws.rs.core.GenericType<java.util.List<Network>>NETWORK_LIST(package private) static longNO_TIMEOUTprivate static javax.ws.rs.core.GenericType<java.util.List<Node>>NODE_LISTprivate javax.ws.rs.client.ClientnoTimeoutClientprivate RegistryAuthSupplierregistryAuthSupplierprivate static javax.ws.rs.core.GenericType<java.util.List<RemovedImage>>REMOVED_IMAGE_LISTprivate static javax.ws.rs.core.GenericType<java.util.List<Secret>>SECRET_LISTprivate static javax.ws.rs.core.GenericType<java.util.List<Service>>SERVICE_LISTprivate static javax.ws.rs.core.GenericType<java.util.List<Task>>TASK_LISTprivate static java.lang.StringUNIX_SCHEMEprivate java.net.URIuri
-
Constructor Summary
Constructors Modifier Constructor Description protectedDefaultDockerClient(DefaultDockerClient.Builder builder)Create a new client using the configuration of the builder.DefaultDockerClient(java.lang.String uri)Create a new client with default configuration.DefaultDockerClient(java.net.URI uri)Create a new client with default configuration.DefaultDockerClient(java.net.URI uri, DockerCertificatesStore dockerCertificatesStore)Create a new client with default configuration.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private javax.ws.rs.client.WebTargetaddParameters(javax.ws.rs.client.WebTarget resource, DockerClient.Param... params)java.io.InputStreamarchiveContainer(java.lang.String containerId, java.lang.String path)Copies an archive out of a container.private voidassertApiVersionIsAbove(java.lang.String minimumVersion)LogStreamattachContainer(java.lang.String containerId, DockerClient.AttachParameter... params)Attach to the container id.intauth(RegistryAuth registryAuth)Check auth configuration.private java.lang.StringauthHeader(RegistryAuth registryAuth)private java.lang.StringauthRegistryHeader(RegistryConfigs registryConfigs)java.lang.Stringbuild(java.nio.file.Path directory, DockerClient.BuildParam... params)Build a docker image.java.lang.Stringbuild(java.nio.file.Path directory, ProgressHandler handler, DockerClient.BuildParam... params)Build a docker image.java.lang.Stringbuild(java.nio.file.Path directory, java.lang.String name, DockerClient.BuildParam... params)Build a docker image.java.lang.Stringbuild(java.nio.file.Path directory, java.lang.String name, ProgressHandler handler, DockerClient.BuildParam... params)Build a docker image.java.lang.Stringbuild(java.nio.file.Path directory, java.lang.String name, java.lang.String dockerfile, ProgressHandler handler, DockerClient.BuildParam... params)Build a docker image.static DefaultDockerClient.Builderbuilder()Create a newDefaultDockerClientbuilder.private voidcheckTtyParams(java.lang.Integer height, java.lang.Integer width)voidclose()Closes any and all underlying connections to docker, and release resources.ContainerCreationcommitContainer(java.lang.String containerId, java.lang.String repo, java.lang.String tag, ContainerConfig config, java.lang.String comment, java.lang.String author)Create a new image from a container's changes.voidconnectToNetwork(java.lang.String networkId, NetworkConnection networkConnection)Connects a docker container to a network, with extended configuration.voidconnectToNetwork(java.lang.String containerId, java.lang.String networkId)Connects a docker container to a network.private voidcontainerAction(java.lang.String containerId, java.lang.String action)private voidcontainerAction(java.lang.String containerId, java.lang.String action, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> queryParameters)java.io.InputStreamcopyContainer(java.lang.String containerId, java.lang.String path)Deprecated.voidcopyToContainer(java.io.InputStream tarStream, java.lang.String containerId, java.lang.String path)voidcopyToContainer(java.nio.file.Path directory, java.lang.String containerId, java.lang.String path)Copies some files from host to container.voidcreate(java.lang.String image, java.io.InputStream imagePayload)Creates a single image from a tarball.voidcreate(java.lang.String image, java.io.InputStream imagePayload, ProgressHandler handler)Creates a single image from a tarball.ConfigCreateResponsecreateConfig(ConfigSpec config)Create a config.ContainerCreationcreateContainer(ContainerConfig config)Create a docker container.ContainerCreationcreateContainer(ContainerConfig config, java.lang.String name)Create a docker container.NetworkCreationcreateNetwork(NetworkConfig networkConfig)Create a new network.SecretCreateResponsecreateSecret(SecretSpec secret)Create a secret.ServiceCreateResponsecreateService(ServiceSpec spec)Create a new service.ServiceCreateResponsecreateService(ServiceSpec spec, RegistryAuth config)Create a new service.VolumecreateVolume()VolumecreateVolume(Volume volume)voiddeleteConfig(java.lang.String configId)Delete a config.voiddeleteNode(java.lang.String nodeId)Remove a node from the swarm.voiddeleteNode(java.lang.String nodeId, boolean force)Remove a node from the swarm.voiddeleteSecret(java.lang.String secretId)Delete a secret.voiddisconnectFromNetwork(java.lang.String containerId, java.lang.String networkId)Disconnects a docker container to a network.voiddisconnectFromNetwork(java.lang.String containerId, java.lang.String networkId, boolean force)Disconnects a docker container to a network.EventStreamevents(DockerClient.EventsParam... params)Watches the docker API for events.ExecCreationexecCreate(java.lang.String containerId, java.lang.String[] cmd, DockerClient.ExecCreateParam... params)Sets up an exec instance in a running container id.ExecStateexecInspect(java.lang.String execId)Inspects a running or previously run exec instance id.voidexecResizeTty(java.lang.String execId, java.lang.Integer height, java.lang.Integer width)Resizes the tty session used by an exec command.LogStreamexecStart(java.lang.String execId, DockerClient.ExecStartParameter... params)Starts a previously set up exec instance id.java.io.InputStreamexportContainer(java.lang.String containerId)Export a docker container as a tar archive.static DefaultDockerClient.BuilderfromEnv()Create a newDefaultDockerClientbuilder prepopulated with values loaded from the DOCKER_HOST and DOCKER_CERT_PATH environment variables.(package private) javax.ws.rs.client.ClientgetClient()private org.apache.http.impl.conn.PoolingHttpClientConnectionManagergetConnectionManager(DefaultDockerClient.Builder builder)DistributiongetDistribution(java.lang.String imageName)Get the distribution of a container.java.lang.StringgetHost()Get the Docker host address.private LogStreamgetLogStream(java.lang.String method, javax.ws.rs.client.WebTarget resource, java.lang.String containerId)(package private) javax.ws.rs.client.ClientgetNoTimeoutClient()private java.util.Map<java.lang.String,java.lang.String>getQueryParamMap(javax.ws.rs.client.WebTarget resource)private org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory>getSchemeRegistry(DefaultDockerClient.Builder builder)private LogStreamgetServiceLogStream(java.lang.String method, javax.ws.rs.client.WebTarget resource, java.lang.String serviceId)private javax.ws.rs.client.Invocation.Builderheaders(javax.ws.rs.client.Invocation.Builder request)java.util.List<ImageHistory>history(java.lang.String image)Return the history of the image.Infoinfo()Get docker instance information.java.lang.StringinitSwarm(SwarmInit swarmInit)Initialize a new swarm.ConfiginspectConfig(java.lang.String configId)Inspect a config.ContainerInfoinspectContainer(java.lang.String containerId)Inspect a docker container.java.util.List<ContainerChange>inspectContainerChanges(java.lang.String containerId)Inspect changes on a container's filesystem.ImageInfoinspectImage(java.lang.String image)Inspect a docker container image.NetworkinspectNetwork(java.lang.String networkId)Inspect a specific network.NodeInfoinspectNode(java.lang.String nodeId)Inspects a swarm node.SecretinspectSecret(java.lang.String secretId)Inspect a secret.ServiceinspectService(java.lang.String serviceId)Inspect an existing service.SwarminspectSwarm()Inspect the swarm.TaskinspectTask(java.lang.String taskId)Inspect an existing task.VolumeinspectVolume(java.lang.String volumeName)voidjoinSwarm(SwarmJoin swarmJoin)Join an existing swarm.voidkillContainer(java.lang.String containerId)Kill a docker container.voidkillContainer(java.lang.String containerId, DockerClient.Signal signal)Kill a docker container.voidleaveSwarm()Leave a swarm.voidleaveSwarm(boolean force)Leave a swarm forcefully.java.util.List<Config>listConfigs()List swarm configs.java.util.List<Config>listConfigs(Config.Criteria criteria)List swarm configs.java.util.List<Container>listContainers(DockerClient.ListContainersParam... params)List docker containers.java.util.List<Image>listImages(DockerClient.ListImagesParam... params)List docker images.java.util.List<Network>listNetworks(DockerClient.ListNetworksParam... params)List all or a subset of the networks.java.util.List<Node>listNodes()List swarm nodes.java.util.List<Node>listNodes(Node.Criteria criteria)List swarm nodes that match the given criteria.java.util.List<Secret>listSecrets()List secrets.java.util.List<Service>listServices()List all services.java.util.List<Service>listServices(Service.Criteria criteria)List services that match the given criteria.java.util.List<Task>listTasks()List all tasks.java.util.List<Task>listTasks(Task.Criteria criteria)List tasks that match the given criteria.VolumeListlistVolumes(DockerClient.ListVolumesParam... params)java.util.Set<java.lang.String>load(java.io.InputStream imagePayload)Load a set of images and tags from a tarball.java.util.Set<java.lang.String>load(java.io.InputStream imagePayload, ProgressHandler handler)Load a set of images and tags from a tarball, using a custom ProgressMessageHandler.voidload(java.lang.String image, java.io.InputStream imagePayload)Deprecated.voidload(java.lang.String image, java.io.InputStream imagePayload, ProgressHandler handler)Deprecated.LogStreamlogs(java.lang.String containerId, DockerClient.LogsParam... params)Get docker container logs.private java.lang.Stringmessage(javax.ws.rs.core.Response response)private javax.ws.rs.client.WebTargetnoTimeoutResource()voidpauseContainer(java.lang.String containerId)Pause a docker container.java.lang.Stringping()Ping the docker daemon.private java.lang.RuntimeExceptionpropagate(java.lang.String method, javax.ws.rs.client.WebTarget resource, java.lang.Exception ex)voidpull(java.lang.String image)Pull a docker container image.voidpull(java.lang.String image, RegistryAuth registryAuth)Pull a private docker container image.voidpull(java.lang.String image, RegistryAuth registryAuth, ProgressHandler handler)Pull a private docker container image, using a custom ProgressMessageHandler.voidpull(java.lang.String image, ProgressHandler handler)Pull a docker container image, using a custom ProgressMessageHandlervoidpush(java.lang.String image)Push a docker container image.voidpush(java.lang.String image, RegistryAuth registryAuth)voidpush(java.lang.String image, ProgressHandler handler)Push a docker container image, using a custom ProgressHandlervoidpush(java.lang.String image, ProgressHandler handler, RegistryAuth registryAuth)voidremoveContainer(java.lang.String containerId)Remove a docker container.voidremoveContainer(java.lang.String containerId, boolean removeVolumes)Deprecated.voidremoveContainer(java.lang.String containerId, DockerClient.RemoveContainerParam... params)Remove a docker container.java.util.List<RemovedImage>removeImage(java.lang.String image)Remove a docker image.java.util.List<RemovedImage>removeImage(java.lang.String image, boolean force, boolean noPrune)Remove a docker image.voidremoveNetwork(java.lang.String networkId)Remove a docker network.voidremoveService(java.lang.String serviceId)Remove an existing service.voidremoveVolume(Volume volume)voidremoveVolume(java.lang.String volumeName)voidrenameContainer(java.lang.String containerId, java.lang.String name)Rename a docker container.private <T> Trequest(java.lang.String method, java.lang.Class<T> clazz, javax.ws.rs.client.WebTarget resource, javax.ws.rs.client.Invocation.Builder request)private <T> Trequest(java.lang.String method, java.lang.Class<T> clazz, javax.ws.rs.client.WebTarget resource, javax.ws.rs.client.Invocation.Builder request, javax.ws.rs.client.Entity<?> entity)private voidrequest(java.lang.String method, javax.ws.rs.client.WebTarget resource, javax.ws.rs.client.Invocation.Builder request)private <T> Trequest(java.lang.String method, javax.ws.rs.core.GenericType<T> type, javax.ws.rs.client.WebTarget resource, javax.ws.rs.client.Invocation.Builder request)private voidrequestAndTail(java.lang.String method, ProgressHandler handler, javax.ws.rs.client.WebTarget resource, javax.ws.rs.client.Invocation.Builder request)private voidrequestAndTail(java.lang.String method, ProgressHandler handler, javax.ws.rs.client.WebTarget resource, javax.ws.rs.client.Invocation.Builder request, javax.ws.rs.client.Entity<?> entity)voidresizeTty(java.lang.String containerId, java.lang.Integer height, java.lang.Integer width)Resize container TTY This API is valid only ifttywas specified as part ofcreatingthe container.private javax.ws.rs.client.WebTargetresource()voidrestartContainer(java.lang.String containerId)Restart a docker container.voidrestartContainer(java.lang.String containerId, int secondsToWaitBeforeRestart)Restart a docker container.java.io.InputStreamsave(java.lang.String... images)Get a tarball containing all images and metadata for the repository specified.java.io.InputStreamsaveMultiple(java.lang.String... images)Get a tarball containing all images and metadata for one or more repositories.java.util.List<ImageSearchResult>searchImages(java.lang.String term)Search for images on Docker HubLogStreamserviceLogs(java.lang.String serviceId, DockerClient.LogsParam... params)Get docker service logs.voidstartContainer(java.lang.String containerId)Start a docker container.ContainerStatsstats(java.lang.String containerId)Retrieves one-time stats (stream=0) for the container with the specified id.voidstopContainer(java.lang.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.voidtag(java.lang.String image, java.lang.String name)Tag a docker image.voidtag(java.lang.String image, java.lang.String name, boolean force)Tag a docker image.private voidtailResponse(java.lang.String method, javax.ws.rs.core.Response response, ProgressHandler handler, javax.ws.rs.client.WebTarget resource)TopResultstopContainer(java.lang.String containerId)List processes running inside the container by usingps.TopResultstopContainer(java.lang.String containerId, java.lang.String psArgs)List processes running inside the container usingpsand the given arguments.private java.lang.StringtoRegExp(java.lang.String hostnameWithWildcards)voidunlock(UnlockKey unlockKey)Unlock a swarm.UnlockKeyunlockKey()Get an unlock key for unlocking a swarm.voidunpauseContainer(java.lang.String containerId)Unpause a docker container.voidupdateConfig(java.lang.String configId, java.lang.Long version, ConfigSpec nodeSpec)Update a swarm config.ContainerUpdateupdateContainer(java.lang.String containerId, HostConfig config)Update an existing container.voidupdateNode(java.lang.String nodeId, java.lang.Long version, NodeSpec nodeSpec)Update a swarm node.private org.glassfish.jersey.client.ClientConfigupdateProxy(org.glassfish.jersey.client.ClientConfig config, DefaultDockerClient.Builder builder)voidupdateService(java.lang.String serviceId, java.lang.Long version, ServiceSpec spec)Update an existing service.voidupdateService(java.lang.String serviceId, java.lang.Long version, ServiceSpec spec, RegistryAuth config)Update an existing service.voidupdateSwarm(java.lang.Long version, boolean rotateWorkerToken, boolean rotateManagerToken, boolean rotateManagerUnlockKey, SwarmSpec spec)Update a swarm.voidupdateSwarm(java.lang.Long version, boolean rotateWorkerToken, boolean rotateManagerToken, SwarmSpec spec)Update a swarm.voidupdateSwarm(java.lang.Long version, boolean rotateWorkerToken, SwarmSpec spec)Update a swarm.voidupdateSwarm(java.lang.Long version, SwarmSpec spec)Update a swarm.private java.lang.StringurlEncode(java.lang.String unencoded)URL-encodes a string when used as a URL query parameter's value.private java.lang.StringurlEncodeFilters(java.util.Map<java.lang.String,java.util.List<java.lang.String>> filters)Takes a map of filters and URL-encodes them.Versionversion()Get the docker version.ContainerExitwaitContainer(java.lang.String containerId)Wait for a docker container to exit.
-
-
-
Field Detail
-
UNIX_SCHEME
private static final java.lang.String UNIX_SCHEME
- See Also:
- Constant Field Values
-
log
private static final org.slf4j.Logger log
-
NO_TIMEOUT
static final long NO_TIMEOUT
- See Also:
- Constant Field Values
-
DEFAULT_CONNECT_TIMEOUT_MILLIS
private static final long DEFAULT_CONNECT_TIMEOUT_MILLIS
-
DEFAULT_READ_TIMEOUT_MILLIS
private static final long DEFAULT_READ_TIMEOUT_MILLIS
-
DEFAULT_CONNECTION_POOL_SIZE
private static final int DEFAULT_CONNECTION_POOL_SIZE
- See Also:
- Constant Field Values
-
defaultConfig
private final org.glassfish.jersey.client.ClientConfig defaultConfig
-
CONTAINER_NAME_PATTERN
private static final java.util.regex.Pattern CONTAINER_NAME_PATTERN
-
CONTAINER_LIST
private static final javax.ws.rs.core.GenericType<java.util.List<Container>> CONTAINER_LIST
-
CONTAINER_CHANGE_LIST
private static final javax.ws.rs.core.GenericType<java.util.List<ContainerChange>> CONTAINER_CHANGE_LIST
-
IMAGE_LIST
private static final javax.ws.rs.core.GenericType<java.util.List<Image>> IMAGE_LIST
-
NETWORK_LIST
private static final javax.ws.rs.core.GenericType<java.util.List<Network>> NETWORK_LIST
-
IMAGES_SEARCH_RESULT_LIST
private static final javax.ws.rs.core.GenericType<java.util.List<ImageSearchResult>> IMAGES_SEARCH_RESULT_LIST
-
REMOVED_IMAGE_LIST
private static final javax.ws.rs.core.GenericType<java.util.List<RemovedImage>> REMOVED_IMAGE_LIST
-
IMAGE_HISTORY_LIST
private static final javax.ws.rs.core.GenericType<java.util.List<ImageHistory>> IMAGE_HISTORY_LIST
-
SERVICE_LIST
private static final javax.ws.rs.core.GenericType<java.util.List<Service>> SERVICE_LIST
-
DISTRIBUTION
private static final javax.ws.rs.core.GenericType<Distribution> DISTRIBUTION
-
TASK_LIST
private static final javax.ws.rs.core.GenericType<java.util.List<Task>> TASK_LIST
-
NODE_LIST
private static final javax.ws.rs.core.GenericType<java.util.List<Node>> NODE_LIST
-
CONFIG_LIST
private static final javax.ws.rs.core.GenericType<java.util.List<Config>> CONFIG_LIST
-
SECRET_LIST
private static final javax.ws.rs.core.GenericType<java.util.List<Secret>> SECRET_LIST
-
client
private final javax.ws.rs.client.Client client
-
noTimeoutClient
private final javax.ws.rs.client.Client noTimeoutClient
-
uri
private final java.net.URI uri
-
apiVersion
private final java.lang.String apiVersion
-
registryAuthSupplier
private final RegistryAuthSupplier registryAuthSupplier
-
headers
private final java.util.Map<java.lang.String,java.lang.Object> headers
-
-
Constructor Detail
-
DefaultDockerClient
public DefaultDockerClient(java.lang.String uri)
Create a new client with default configuration.- Parameters:
uri- The docker rest api uri.
-
DefaultDockerClient
public DefaultDockerClient(java.net.URI uri)
Create a new client with default configuration.- Parameters:
uri- The docker rest api uri.
-
DefaultDockerClient
public DefaultDockerClient(java.net.URI uri, DockerCertificatesStore dockerCertificatesStore)Create a new client with default configuration.- Parameters:
uri- The docker rest api uri.dockerCertificatesStore- The certificates to use for HTTPS.
-
DefaultDockerClient
protected DefaultDockerClient(DefaultDockerClient.Builder builder)
Create a new client using the configuration of the builder.- Parameters:
builder- DefaultDockerClient builder
-
-
Method Detail
-
getClient
javax.ws.rs.client.Client getClient()
-
getNoTimeoutClient
javax.ws.rs.client.Client getNoTimeoutClient()
-
updateProxy
private org.glassfish.jersey.client.ClientConfig updateProxy(org.glassfish.jersey.client.ClientConfig config, DefaultDockerClient.Builder builder)
-
toRegExp
private java.lang.String toRegExp(java.lang.String hostnameWithWildcards)
-
getHost
public java.lang.String getHost()
Description copied from interface:DockerClientGet the Docker host address.- Specified by:
getHostin interfaceDockerClient- Returns:
- the docker host name or IP
-
getConnectionManager
private org.apache.http.impl.conn.PoolingHttpClientConnectionManager getConnectionManager(DefaultDockerClient.Builder builder)
-
getSchemeRegistry
private org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> getSchemeRegistry(DefaultDockerClient.Builder builder)
-
close
public void close()
Description copied from interface:DockerClientCloses any and all underlying connections to docker, and release resources.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceDockerClient
-
ping
public java.lang.String ping() throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientPing the docker daemon. Returns "OK" if all is well, though that it simply returns a 200 status is probably sufficient information.- Specified by:
pingin interfaceDockerClient- Returns:
- String "OK"
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
version
public Version version() throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientGet the docker version.- Specified by:
versionin interfaceDockerClient- Returns:
- docker version
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
auth
public int auth(RegistryAuth registryAuth) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientCheck auth configuration.- Specified by:
authin interfaceDockerClient- Parameters:
registryAuth- TheRegistryAuthneeded to pull the image.- Returns:
- status code of auth request
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
info
public Info info() throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientGet docker instance information.- Specified by:
infoin interfaceDockerClient- Returns:
- docker info
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
listContainers
public java.util.List<Container> listContainers(DockerClient.ListContainersParam... params) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientList docker containers.- Specified by:
listContainersin interfaceDockerClient- Parameters:
params- Container listing and filtering options.- Returns:
- A list of containers.
- Throws:
BadParamException- if one or more params were bad (400)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
addParameters
private javax.ws.rs.client.WebTarget addParameters(javax.ws.rs.client.WebTarget resource, DockerClient.Param... params) throws DockerException- Throws:
DockerException
-
getQueryParamMap
private java.util.Map<java.lang.String,java.lang.String> getQueryParamMap(javax.ws.rs.client.WebTarget resource)
-
urlEncode
private java.lang.String urlEncode(java.lang.String unencoded) throws DockerExceptionURL-encodes a string when used as a URL query parameter's value.- Parameters:
unencoded- A string that may contain characters not allowed in URL query parameters.- Returns:
- URL-encoded String
- Throws:
DockerException- if there's an UnsupportedEncodingException
-
urlEncodeFilters
private java.lang.String urlEncodeFilters(java.util.Map<java.lang.String,java.util.List<java.lang.String>> filters) throws DockerExceptionTakes a map of filters and URL-encodes them. If the map is empty or an exception occurs, return null.- Parameters:
filters- A map of filters.- Returns:
- String
- Throws:
DockerException- if there's an IOException
-
listImages
public java.util.List<Image> listImages(DockerClient.ListImagesParam... params) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientList docker images.- Specified by:
listImagesin interfaceDockerClient- Parameters:
params- Image listing and filtering options.- Returns:
- A list of images.
- Throws:
BadParamException- if one or more params were bad (400)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
createContainer
public ContainerCreation createContainer(ContainerConfig config) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientCreate a docker container.- Specified by:
createContainerin interfaceDockerClient- Parameters:
config- The container configuration.- Returns:
- Container creation result with container id and eventual warnings from docker.
- Throws:
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)java.lang.InterruptedException- If the thread is interrupted
-
createContainer
public ContainerCreation createContainer(ContainerConfig config, java.lang.String name) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientCreate a docker container.- Specified by:
createContainerin interfaceDockerClient- Parameters:
config- The container configuration.name- The container name.- Returns:
- Container creation result with container id and eventual warnings from docker.
- Throws:
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)java.lang.InterruptedException- If the thread is interrupted
-
startContainer
public void startContainer(java.lang.String containerId) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientStart a docker container.- Specified by:
startContainerin interfaceDockerClient- Parameters:
containerId- The id of the container to start.- Throws:
ContainerNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
containerAction
private void containerAction(java.lang.String containerId, java.lang.String action) throws DockerException, java.lang.InterruptedException- Throws:
DockerExceptionjava.lang.InterruptedException
-
containerAction
private void containerAction(java.lang.String containerId, java.lang.String action, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> queryParameters) throws DockerException, java.lang.InterruptedException- Throws:
DockerExceptionjava.lang.InterruptedException
-
pauseContainer
public void pauseContainer(java.lang.String containerId) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientPause a docker container.- Specified by:
pauseContainerin interfaceDockerClient- Parameters:
containerId- The id of the container to pause.- Throws:
ContainerNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
unpauseContainer
public void unpauseContainer(java.lang.String containerId) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientUnpause a docker container.- Specified by:
unpauseContainerin interfaceDockerClient- Parameters:
containerId- The id of the container to pause.- Throws:
ContainerNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
restartContainer
public void restartContainer(java.lang.String containerId) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientRestart a docker container. with a 10 second default wait- Specified by:
restartContainerin interfaceDockerClient- Parameters:
containerId- The id of the container to restart.- Throws:
ContainerNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
restartContainer
public void restartContainer(java.lang.String containerId, int secondsToWaitBeforeRestart) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientRestart a docker container.- Specified by:
restartContainerin interfaceDockerClient- Parameters:
containerId- The id of the container to restart.secondsToWaitBeforeRestart- number of seconds to wait before killing the container.- Throws:
ContainerNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
killContainer
public void killContainer(java.lang.String containerId) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientKill a docker container. Note: by default SIGKILL is sent.- Specified by:
killContainerin interfaceDockerClient- Parameters:
containerId- The id of the container to kill.- Throws:
ContainerNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
killContainer
public void killContainer(java.lang.String containerId, DockerClient.Signal signal) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientKill a docker container.- Specified by:
killContainerin interfaceDockerClient- Parameters:
containerId- The id of the container to kill.signal- Signal used to kill the process.- Throws:
ContainerNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
getDistribution
public Distribution getDistribution(java.lang.String imageName) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientGet the distribution of a container.- Specified by:
getDistributionin interfaceDockerClient- Parameters:
imageName- The name of the container.- Throws:
ContainerNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
stopContainer
public void stopContainer(java.lang.String containerId, int secondsToWaitBeforeKilling) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientStop 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.- Specified by:
stopContainerin interfaceDockerClient- Parameters:
containerId- The id of the container to stop.secondsToWaitBeforeKilling- Time to wait after SIGTERM before sending SIGKILL.- Throws:
ContainerNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
waitContainer
public ContainerExit waitContainer(java.lang.String containerId) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientWait for a docker container to exit.- Specified by:
waitContainerin interfaceDockerClient- Parameters:
containerId- The id of the container to wait for.- Returns:
- Exit response with status code.
- Throws:
ContainerNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
removeContainer
public void removeContainer(java.lang.String containerId) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientRemove a docker container.- Specified by:
removeContainerin interfaceDockerClient- Parameters:
containerId- The id of the container to remove.- Throws:
BadParamException- if one or more params were bad (400)ContainerNotFoundException- if container is not found (404)DockerException- If a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
removeContainer
@Deprecated public void removeContainer(java.lang.String containerId, boolean removeVolumes) throws DockerException, java.lang.InterruptedExceptionDeprecated.Description copied from interface:DockerClientRemove a docker container.- Specified by:
removeContainerin interfaceDockerClient- Parameters:
containerId- The id of the container to remove.removeVolumes- Whether to remove volumes as well.- Throws:
BadParamException- if one or more params were bad (400)ContainerNotFoundException- if container is not found (404)DockerException- If a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
removeContainer
public void removeContainer(java.lang.String containerId, DockerClient.RemoveContainerParam... params) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientRemove a docker container.- Specified by:
removeContainerin interfaceDockerClient- Parameters:
containerId- The id of the container to remove.params-DockerClient.RemoveContainerParam- Throws:
BadParamException- if one or more params were bad (400)ContainerNotFoundException- if container is not found (404)DockerException- If a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
exportContainer
public java.io.InputStream exportContainer(java.lang.String containerId) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientExport a docker container as a tar archive.- Specified by:
exportContainerin interfaceDockerClient- Parameters:
containerId- The id of the container to export.- Returns:
- A stream in tar format that contains the contents of the container file system.
- Throws:
ContainerNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
copyContainer
@Deprecated public java.io.InputStream copyContainer(java.lang.String containerId, java.lang.String path) throws DockerException, java.lang.InterruptedExceptionDeprecated.Description copied from interface:DockerClientCopies some files out of a container. (removed on API version 1.24)- Specified by:
copyContainerin interfaceDockerClient- Parameters:
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.- Returns:
- A stream in tar format that contains the copied files. If a directory was copied, the
directory will be at the root of the tar archive (so
copy(..., "/usr/share")will result in a directory calledsharein 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. - Throws:
ContainerNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)UnsupportedApiVersionException- If client API is greater than or equal to 1.24java.lang.InterruptedException- If the thread is interrupted
-
archiveContainer
public java.io.InputStream archiveContainer(java.lang.String containerId, java.lang.String path) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientCopies an archive out of a container. (API version 1.20+)- Specified by:
archiveContainerin interfaceDockerClient- Parameters:
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.- Returns:
- A stream in tar format that contains the copied files. If a directory was copied, the
directory will be at the root of the tar archive (so
copy(..., "/usr/share")will result in a directory calledsharein 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. - Throws:
ContainerNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
topContainer
public TopResults topContainer(java.lang.String containerId) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientList processes running inside the container by usingps.- Specified by:
topContainerin interfaceDockerClient- Parameters:
containerId- the id of the container to examine- Returns:
- the titles and process list for the container
- Throws:
DockerException- if a server error occurred (500).java.lang.InterruptedException- if the thread is interrupted.
-
topContainer
public TopResults topContainer(java.lang.String containerId, java.lang.String psArgs) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientList processes running inside the container usingpsand the given arguments.- Specified by:
topContainerin interfaceDockerClient- Parameters:
containerId- the id of the container to examinepsArgs- the arguments to pass topsinside the container, e.g.,"-ef"- Returns:
- the titles and process list for the container
- Throws:
DockerException- if a server error occurred (500).java.lang.InterruptedException- if the thread is interrupted.
-
copyToContainer
public void copyToContainer(java.nio.file.Path directory, java.lang.String containerId, java.lang.String path) throws DockerException, java.lang.InterruptedException, java.io.IOExceptionDescription copied from interface:DockerClientCopies some files from host to container. (API version 1.20+)- Specified by:
copyToContainerin interfaceDockerClient- Parameters:
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.- Throws:
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)java.lang.InterruptedException- If the thread is interruptedjava.io.IOException- If IOException
-
copyToContainer
public void copyToContainer(java.io.InputStream tarStream, java.lang.String containerId, java.lang.String path) throws DockerException, java.lang.InterruptedException- Specified by:
copyToContainerin interfaceDockerClient- Throws:
DockerExceptionjava.lang.InterruptedException
-
inspectContainerChanges
public java.util.List<ContainerChange> inspectContainerChanges(java.lang.String containerId) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientInspect changes on a container's filesystem.- Specified by:
inspectContainerChangesin interfaceDockerClient- Parameters:
containerId- The id of the container.- Returns:
- A list of the changes to the container file system.
- Throws:
ContainerNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
inspectContainer
public ContainerInfo inspectContainer(java.lang.String containerId) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientInspect a docker container.- Specified by:
inspectContainerin interfaceDockerClient- Parameters:
containerId- The id of the container to inspect.- Returns:
- Info about the container.
- Throws:
ContainerNotFoundException- if container was not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
commitContainer
public ContainerCreation commitContainer(java.lang.String containerId, java.lang.String repo, java.lang.String tag, ContainerConfig config, java.lang.String comment, java.lang.String author) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientCreate a new image from a container's changes.- Specified by:
commitContainerin interfaceDockerClient- Parameters:
containerId- The id of the container to commit.repo- repository to commit to.tag- image tag.config- ContainerConfig to commit.comment- commit message.author- image author.- Returns:
- ContainerCreation reply.
- Throws:
ContainerNotFoundException- if container was not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
renameContainer
public void renameContainer(java.lang.String containerId, java.lang.String name) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientRename a docker container.- Specified by:
renameContainerin interfaceDockerClient- Parameters:
containerId- The id of the container to rename.name- The new name the container will have- Throws:
ContainerNotFoundException- if container cannot be found (404)ContainerRenameConflictException- if name is already assigned (409)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
updateContainer
public ContainerUpdate updateContainer(java.lang.String containerId, HostConfig config) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientUpdate an existing container. Only available in Docker API >= 1.22.- Specified by:
updateContainerin interfaceDockerClient- Parameters:
containerId- the identifier of the containerconfig- the new container host config- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
searchImages
public java.util.List<ImageSearchResult> searchImages(java.lang.String term) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientSearch for images on Docker HubThis method is broken for Docker 1.7.x because of a Docker bug. See https://github.com/docker/docker/pull/14850.
- Specified by:
searchImagesin interfaceDockerClient- Parameters:
term- the search term- Returns:
- a list of matches for the given search term
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
load
@Deprecated public void load(java.lang.String image, java.io.InputStream imagePayload) throws DockerException, java.lang.InterruptedExceptionDeprecated.Description copied from interface:DockerClientCreates a single image from a tarball. This method also tags the image with the given image name upon loading completion.- Specified by:
loadin interfaceDockerClient- Parameters:
image- the name to assign to the image.imagePayload- the image's payload (i.e.: the stream corresponding to the image's .tar file).- Throws:
DockerException- if a server error occurred (500).java.lang.InterruptedException- if the thread is interrupted.
-
load
@Deprecated public void load(java.lang.String image, java.io.InputStream imagePayload, ProgressHandler handler) throws DockerException, java.lang.InterruptedExceptionDeprecated.Description copied from interface:DockerClientCreates a single image from a tarball. This method also tags the image with the given image name upon loading completion.- Specified by:
loadin interfaceDockerClient- Parameters:
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.- Throws:
DockerException- if a server error occurred (500).java.lang.InterruptedException- if the thread is interrupted.
-
load
public java.util.Set<java.lang.String> load(java.io.InputStream imagePayload) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientLoad a set of images and tags from a tarball.- Specified by:
loadin interfaceDockerClient- Parameters:
imagePayload- the image's payload (i.e.: the stream corresponding to the image's .tar file).- Returns:
- a set of all loaded images
- Throws:
DockerException- if a server error occurred (500).java.lang.InterruptedException- if the thread is interrupted.
-
load
public java.util.Set<java.lang.String> load(java.io.InputStream imagePayload, ProgressHandler handler) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientLoad a set of images and tags from a tarball, using a custom ProgressMessageHandler.- Specified by:
loadin interfaceDockerClient- Parameters:
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.- Returns:
- a set of all loaded images
- Throws:
DockerException- if a server error occurred (500).java.lang.InterruptedException- if the thread is interrupted.
-
create
public void create(java.lang.String image, java.io.InputStream imagePayload) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientCreates a single image from a tarball. This method also tags the image with the given image name upon loading completion.- Specified by:
createin interfaceDockerClient- Parameters:
image- the name to assign to the image.imagePayload- the image's payload (i.e.: the stream corresponding to the image's .tar file).- Throws:
DockerException- if a server error occurred (500).java.lang.InterruptedException- if the thread is interrupted.
-
create
public void create(java.lang.String image, java.io.InputStream imagePayload, ProgressHandler handler) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientCreates a single image from a tarball. This method also tags the image with the given image name upon loading completion.- Specified by:
createin interfaceDockerClient- Parameters:
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.- Throws:
DockerException- if a server error occurred (500).java.lang.InterruptedException- if the thread is interrupted.
-
save
public java.io.InputStream save(java.lang.String... images) throws DockerException, java.io.IOException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientGet a tarball containing all images and metadata for the repository specified.- Specified by:
savein interfaceDockerClient- Parameters:
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.- Returns:
- the images' .tar streams.
- Throws:
DockerException- if a server error occurred (500).java.io.IOException- if the server started returning, but an I/O error occurred in the context of processing it on the client-side.java.lang.InterruptedException- if the thread is interrupted.
-
saveMultiple
public java.io.InputStream saveMultiple(java.lang.String... images) throws DockerException, java.io.IOException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientGet a tarball containing all images and metadata for one or more repositories.- Specified by:
saveMultiplein interfaceDockerClient- Parameters:
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.- Returns:
- a tar stream containing the image(s)
- Throws:
DockerException- if a server error occurred (500).java.io.IOException- if the server started returning, but an I/O error occurred in the context of processing it on the client-side.java.lang.InterruptedException- if the thread is interrupted.
-
pull
public void pull(java.lang.String image) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientPull a docker container image.- Specified by:
pullin interfaceDockerClient- Parameters:
image- The image to pull.- Throws:
ImageNotFoundException- if image was not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
pull
public void pull(java.lang.String image, ProgressHandler handler) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientPull a docker container image, using a custom ProgressMessageHandler- Specified by:
pullin interfaceDockerClient- Parameters:
image- The image to pull.handler- The handler to use for processing each progress message received from Docker.- Throws:
ImageNotFoundException- if image was not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
pull
public void pull(java.lang.String image, RegistryAuth registryAuth) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientPull a private docker container image.- Specified by:
pullin interfaceDockerClient- Parameters:
image- The image to pull.registryAuth- TheRegistryAuthneeded to pull the image.- Throws:
ImageNotFoundException- if image was not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
pull
public void pull(java.lang.String image, RegistryAuth registryAuth, ProgressHandler handler) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientPull a private docker container image, using a custom ProgressMessageHandler.- Specified by:
pullin interfaceDockerClient- Parameters:
image- The image to pull.registryAuth- TheRegistryAuthneeded to pull the image.handler- The handler to use for processing each progress message received from Docker.- Throws:
ImageNotFoundException- if image was not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
push
public void push(java.lang.String image) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientPush a docker container image.- Specified by:
pushin interfaceDockerClient- Parameters:
image- The image to push.- Throws:
ImageNotFoundException- if image was not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
push
public void push(java.lang.String image, RegistryAuth registryAuth) throws DockerException, java.lang.InterruptedException- Specified by:
pushin interfaceDockerClient- Throws:
DockerExceptionjava.lang.InterruptedException
-
push
public void push(java.lang.String image, ProgressHandler handler) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientPush a docker container image, using a custom ProgressHandler- Specified by:
pushin interfaceDockerClient- Parameters:
image- The image to push.handler- The handler to use for processing each progress message received from Docker.- Throws:
ImageNotFoundException- if image was not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
push
public void push(java.lang.String image, ProgressHandler handler, RegistryAuth registryAuth) throws DockerException, java.lang.InterruptedException- Specified by:
pushin interfaceDockerClient- Throws:
DockerExceptionjava.lang.InterruptedException
-
tag
public void tag(java.lang.String image, java.lang.String name) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientTag a docker image.- Specified by:
tagin interfaceDockerClient- Parameters:
image- The image to tag.name- The new name that will be applied to the image.- Throws:
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)java.lang.InterruptedException- If the thread is interrupted
-
tag
public void tag(java.lang.String image, java.lang.String name, boolean force) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientTag a docker image.- Specified by:
tagin interfaceDockerClient- Parameters:
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.- Throws:
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)java.lang.InterruptedException- If the thread is interrupted
-
build
public java.lang.String build(java.nio.file.Path directory, DockerClient.BuildParam... params) throws DockerException, java.lang.InterruptedException, java.io.IOExceptionDescription copied from interface:DockerClientBuild a docker image.- Specified by:
buildin interfaceDockerClient- Parameters:
directory- The directory containing the dockerfile.params- Additional flags to use during build.- Returns:
- The id of the built image if successful, otherwise null.
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interruptedjava.io.IOException- If some IO shit happened.
-
build
public java.lang.String build(java.nio.file.Path directory, java.lang.String name, DockerClient.BuildParam... params) throws DockerException, java.lang.InterruptedException, java.io.IOExceptionDescription copied from interface:DockerClientBuild a docker image.- Specified by:
buildin interfaceDockerClient- Parameters:
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.- Returns:
- The id of the built image if successful, otherwise null.
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interruptedjava.io.IOException- If some IO shit happened.
-
build
public java.lang.String build(java.nio.file.Path directory, ProgressHandler handler, DockerClient.BuildParam... params) throws DockerException, java.lang.InterruptedException, java.io.IOExceptionDescription copied from interface:DockerClientBuild a docker image.- Specified by:
buildin interfaceDockerClient- Parameters:
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.- Returns:
- The id of the built image if successful, otherwise null.
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interruptedjava.io.IOException- If some IO shit happened.
-
build
public java.lang.String build(java.nio.file.Path directory, java.lang.String name, ProgressHandler handler, DockerClient.BuildParam... params) throws DockerException, java.lang.InterruptedException, java.io.IOExceptionDescription copied from interface:DockerClientBuild a docker image.- Specified by:
buildin interfaceDockerClient- Parameters:
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.- Returns:
- The id of the built image if successful, otherwise null.
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interruptedjava.io.IOException- If some IO shit happened.
-
build
public java.lang.String build(java.nio.file.Path directory, java.lang.String name, java.lang.String dockerfile, ProgressHandler handler, DockerClient.BuildParam... params) throws DockerException, java.lang.InterruptedException, java.io.IOExceptionDescription copied from interface:DockerClientBuild a docker image.- Specified by:
buildin interfaceDockerClient- Parameters:
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.- Returns:
- The id of the built image if successful, otherwise null.
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interruptedjava.io.IOException- If some IO shit happened.
-
inspectImage
public ImageInfo inspectImage(java.lang.String image) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientInspect a docker container image.- Specified by:
inspectImagein interfaceDockerClient- Parameters:
image- The image to inspect.- Returns:
- Info about the image.
- Throws:
ImageNotFoundException- if image was not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
removeImage
public java.util.List<RemovedImage> removeImage(java.lang.String image) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientRemove a docker image.- Specified by:
removeImagein interfaceDockerClient- Parameters:
image- The image to remove.- Returns:
- A list describing each image which was removed.
- Throws:
ImageNotFoundException- if image was not found (404)ConflictException- conflict (409)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
removeImage
public java.util.List<RemovedImage> removeImage(java.lang.String image, boolean force, boolean noPrune) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientRemove a docker image.- Specified by:
removeImagein interfaceDockerClient- Parameters:
image- The image to remove.force- Force image removal.noPrune- Do not delete untagged parents.- Returns:
- A list describing each image which was removed.
- Throws:
ImageNotFoundException- if image was not found (404)ConflictException- conflict (409)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
history
public java.util.List<ImageHistory> history(java.lang.String image) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientReturn the history of the image.- Specified by:
historyin interfaceDockerClient- Parameters:
image- An image name or ID.- Returns:
- A List of
ImageHistory - Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
logs
public LogStream logs(java.lang.String containerId, DockerClient.LogsParam... params) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientGet docker container logs.- Specified by:
logsin interfaceDockerClient- Parameters:
containerId- The id of the container to get logs for.params- Params for controlling what streams to get and whether to tail or not.- Returns:
- A log message stream.
- Throws:
BadParamException- if one or more params were bad (400)ContainerNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
events
public EventStream events(DockerClient.EventsParam... params) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientWatches the docker API for events.This method is broken for Docker 1.7.x because of a Docker bug. See https://github.com/docker/docker/issues/14354.
- Specified by:
eventsin interfaceDockerClient- Parameters:
params- The parameters to apply to the events request- Returns:
- An event stream
- Throws:
DockerException- If a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
attachContainer
public LogStream attachContainer(java.lang.String containerId, DockerClient.AttachParameter... params) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientAttach to the container id.- Specified by:
attachContainerin interfaceDockerClient- Parameters:
containerId- The id of the container to get logs for.params- Params for controlling what streams to get and whether to tail or not.- Returns:
- A log message stream.
- Throws:
BadParamException- if one or more params were bad (400)ContainerNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
getLogStream
private LogStream getLogStream(java.lang.String method, javax.ws.rs.client.WebTarget resource, java.lang.String containerId) throws DockerException, java.lang.InterruptedException
- Throws:
DockerExceptionjava.lang.InterruptedException
-
getServiceLogStream
private LogStream getServiceLogStream(java.lang.String method, javax.ws.rs.client.WebTarget resource, java.lang.String serviceId) throws DockerException, java.lang.InterruptedException
- Throws:
DockerExceptionjava.lang.InterruptedException
-
execCreate
public ExecCreation execCreate(java.lang.String containerId, java.lang.String[] cmd, DockerClient.ExecCreateParam... params) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientSets up an exec instance in a running container id.- Specified by:
execCreatein interfaceDockerClient- Parameters:
containerId- The id of the containercmd- shell commandparams- Exec params- Returns:
ExecCreation- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
execStart
public LogStream execStart(java.lang.String execId, DockerClient.ExecStartParameter... params) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientStarts a previously set up exec instance id. If detach is true, this API returns after starting the exec command. Otherwise, this API sets up an interactive session with the exec command.- Specified by:
execStartin interfaceDockerClient- Parameters:
execId- exec idparams- Exec start params- Returns:
- exec output
- Throws:
ExecNotFoundException- if exec instance is not found (404)ExecStartConflictException- if container is paused (409)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
inspectSwarm
public Swarm inspectSwarm() throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientInspect the swarm. Only available in Docker API >= 1.24.- Specified by:
inspectSwarmin interfaceDockerClient- Returns:
- Info about a swarm
- Throws:
DockerException- If a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
initSwarm
public java.lang.String initSwarm(SwarmInit swarmInit) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientInitialize a new swarm. Only available in Docker API >= 1.24.- Specified by:
initSwarmin interfaceDockerClient- Returns:
- Node ID
- Throws:
DockerException- If a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
joinSwarm
public void joinSwarm(SwarmJoin swarmJoin) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientJoin an existing swarm. Only available in Docker API >= 1.24.- Specified by:
joinSwarmin interfaceDockerClient- Throws:
DockerException- If a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
leaveSwarm
public void leaveSwarm() throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientLeave a swarm. Only available in Docker API >= 1.24.- Specified by:
leaveSwarmin interfaceDockerClient- Throws:
DockerException- If a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
leaveSwarm
public void leaveSwarm(boolean force) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientLeave a swarm forcefully. Only available in Docker API >= 1.24. Force leave swarm, even if this is the last manager or if leaving will break the cluster.- Specified by:
leaveSwarmin interfaceDockerClient- Parameters:
force- Whether to leave forcefully- Throws:
DockerException- If a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
updateSwarm
public void updateSwarm(java.lang.Long version, boolean rotateWorkerToken, boolean rotateManagerToken, boolean rotateManagerUnlockKey, SwarmSpec spec) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientUpdate a swarm. Only available in Docker API >= 1.24.- Specified by:
updateSwarmin interfaceDockerClient- Parameters:
version- The version number of the swarm object being updated. This is required to avoid conflicting writes.rotateWorkerToken- Set to true to rotate the worker join token.rotateManagerToken- Set to true to rotate the worker join token.rotateManagerUnlockKey- Set to true to rotate the manager unlock key.spec-SwarmSpec- Throws:
DockerException- If a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
updateSwarm
public void updateSwarm(java.lang.Long version, boolean rotateWorkerToken, boolean rotateManagerToken, SwarmSpec spec) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientUpdate a swarm. Only available in Docker API >= 1.24.- Specified by:
updateSwarmin interfaceDockerClient- Parameters:
version- The version number of the swarm object being updated. This is required to avoid conflicting writes.rotateWorkerToken- Set to true to rotate the worker join token.rotateManagerToken- Set to true to rotate the worker join token.spec-SwarmSpec- Throws:
DockerException- If a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
updateSwarm
public void updateSwarm(java.lang.Long version, boolean rotateWorkerToken, SwarmSpec spec) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientUpdate a swarm. Only available in Docker API >= 1.24.- Specified by:
updateSwarmin interfaceDockerClient- Parameters:
version- The version number of the swarm object being updated. This is required to avoid conflicting writes.rotateWorkerToken- Set to true to rotate the worker join token.spec-SwarmSpec- Throws:
DockerException- If a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
updateSwarm
public void updateSwarm(java.lang.Long version, SwarmSpec spec) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientUpdate a swarm. Only available in Docker API >= 1.24.- Specified by:
updateSwarmin interfaceDockerClient- Parameters:
version- The version number of the swarm object being updated. This is required to avoid conflicting writes.spec-SwarmSpec- Throws:
DockerException- If a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
unlockKey
public UnlockKey unlockKey() throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientGet an unlock key for unlocking a swarm. Only available in Docker API >= 1.25.- Specified by:
unlockKeyin interfaceDockerClient- Returns:
UnlockKey- Throws:
DockerException- If a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
unlock
public void unlock(UnlockKey unlockKey) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientUnlock a swarm. Only available in Docker API >= 1.25.- Specified by:
unlockin interfaceDockerClient- Parameters:
unlockKey-UnlockKey- Throws:
DockerException- If a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
createService
public ServiceCreateResponse createService(ServiceSpec spec) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientCreate a new service. Only available in Docker API >= 1.24.- Specified by:
createServicein interfaceDockerClient- Parameters:
spec- the service spec- Returns:
- Service creation result with service id.
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
createService
public ServiceCreateResponse createService(ServiceSpec spec, RegistryAuth config) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientCreate a new service. Only available in Docker API >= 1.24.- Specified by:
createServicein interfaceDockerClient- Parameters:
spec- the service specconfig- the registry authentication configuration- Returns:
- Service creation result with service id.
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
inspectService
public Service inspectService(java.lang.String serviceId) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientInspect an existing service. Only available in Docker API >= 1.24.- Specified by:
inspectServicein interfaceDockerClient- Parameters:
serviceId- the id of the service to inspect- Returns:
- Info about the service
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
updateService
public void updateService(java.lang.String serviceId, java.lang.Long version, ServiceSpec spec) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientUpdate an existing service. Only available in Docker API >= 1.24.- Specified by:
updateServicein interfaceDockerClient- Parameters:
serviceId- the identifier of the serviceversion- the version of the servicespec- the new service spec- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
updateService
public void updateService(java.lang.String serviceId, java.lang.Long version, ServiceSpec spec, RegistryAuth config) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientUpdate an existing service. Only available in Docker API >= 1.24.- Specified by:
updateServicein interfaceDockerClient- Parameters:
serviceId- the identifier of the serviceversion- the version of the servicespec- the new service specconfig- the registry authentication configuration- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
listServices
public java.util.List<Service> listServices() throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientList all services. Only available in Docker API >= 1.24.- Specified by:
listServicesin interfaceDockerClient- Returns:
- A list of services.
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
listServices
public java.util.List<Service> listServices(Service.Criteria criteria) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientList services that match the given criteria. Only available in Docker API >= 1.24.- Specified by:
listServicesin interfaceDockerClient- Parameters:
criteria- Service listing and filtering options.- Returns:
- A list of
Services - Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
removeService
public void removeService(java.lang.String serviceId) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientRemove an existing service. Only available in Docker API >= 1.24.- Specified by:
removeServicein interfaceDockerClient- Parameters:
serviceId- the id of the service to remove- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
serviceLogs
public LogStream serviceLogs(java.lang.String serviceId, DockerClient.LogsParam... params) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientGet docker service logs.- Specified by:
serviceLogsin interfaceDockerClient- Parameters:
serviceId- The id of the service to get logs for.params- Params for controlling what streams to get and whether to tail or not.- Returns:
- A log message stream.
- Throws:
BadParamException- if one or more params were bad (400)ServiceNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
inspectTask
public Task inspectTask(java.lang.String taskId) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientInspect an existing task. Only available in Docker API >= 1.24.- Specified by:
inspectTaskin interfaceDockerClient- Parameters:
taskId- the id of the task to inspect- Returns:
- Info about the task
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
listTasks
public java.util.List<Task> listTasks() throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientList all tasks. Only available in Docker API >= 1.24.- Specified by:
listTasksin interfaceDockerClient- Returns:
- A list of tasks.
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
listTasks
public java.util.List<Task> listTasks(Task.Criteria criteria) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientList tasks that match the given criteria. Only available in Docker API >= 1.24.- Specified by:
listTasksin interfaceDockerClient- Parameters:
criteria-Task.Criteria- Returns:
- A list of tasks.
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
listConfigs
public java.util.List<Config> listConfigs() throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientList swarm configs. Only available in Docker API >= 1.30.- Specified by:
listConfigsin interfaceDockerClient- Returns:
- a list of configs
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- if the thread is interrupted
-
listConfigs
public java.util.List<Config> listConfigs(Config.Criteria criteria) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientList swarm configs. Only available in Docker API >= 1.30.- Specified by:
listConfigsin interfaceDockerClient- Parameters:
criteria- Config listing and filtering options- Returns:
- a list of configs.
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- if the thread is interrupted
-
createConfig
public ConfigCreateResponse createConfig(ConfigSpec config) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientCreate a config. Only available in Docker API >= 1.30.- Specified by:
createConfigin interfaceDockerClient- Parameters:
config- The spec for the config.- Returns:
ConfigCreateResponse- Throws:
ConflictException- conflict (409)DockerException- if node is not part of a swarm (503) or a server error occurred (500)java.lang.InterruptedException
-
inspectConfig
public Config inspectConfig(java.lang.String configId) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientInspect a config. Only available in Docker API >= 1.30.- Specified by:
inspectConfigin interfaceDockerClient- Parameters:
configId- The id of the config.- Returns:
Config- Throws:
NotFoundException- config not found (404)DockerException- if node is not part of a swarm (503) or a server error occurred (500)java.lang.InterruptedException
-
deleteConfig
public void deleteConfig(java.lang.String configId) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientDelete a config. Only available in Docker API >= 1.30.- Specified by:
deleteConfigin interfaceDockerClient- Parameters:
configId- The id of the config.- Throws:
NotFoundException- config not found (404)DockerException- if node is not part of a swarm (503) or a server error occurred (500)java.lang.InterruptedException
-
updateConfig
public void updateConfig(java.lang.String configId, java.lang.Long version, ConfigSpec nodeSpec) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientUpdate a swarm config. Only available in Docker API >= 1.30.- Specified by:
updateConfigin interfaceDockerClient- Parameters:
configId- The id of the config to updateversion- The version number of the config object being updated. This is required to avoid conflicting writes- Throws:
NodeNotFoundException- If the config doesn't exist (404)NonSwarmNodeException- If the config is not part of a swarm (503)DockerException- If a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
listNodes
public java.util.List<Node> listNodes() throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientList swarm nodes. Only available in Docker API >= 1.24.- Specified by:
listNodesin interfaceDockerClient- Returns:
- A list of nodes.
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
listNodes
public java.util.List<Node> listNodes(Node.Criteria criteria) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientList swarm nodes that match the given criteria. Only available in Docker API >= 1.24.- Specified by:
listNodesin interfaceDockerClient- Parameters:
criteria- Node listing and filtering options.- Returns:
- A list of nodes.
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
inspectNode
public NodeInfo inspectNode(java.lang.String nodeId) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientInspects a swarm node. Only available in Docker API >= 1.24.- Specified by:
inspectNodein interfaceDockerClient- Parameters:
nodeId- The id of the swarm node to inspect- Returns:
- info about the node
- Throws:
NonSwarmNodeException- if the node is not part of a swarm (503)DockerException- if a server error occurred (500)java.lang.InterruptedException- if the thread is interrupted
-
updateNode
public void updateNode(java.lang.String nodeId, java.lang.Long version, NodeSpec nodeSpec) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientUpdate a swarm node. Only available in Docker API >= 1.24.- Specified by:
updateNodein interfaceDockerClient- Parameters:
nodeId- The id of the node to updateversion- The version number of the node object being updated. This is required to avoid conflicting writes- Throws:
NodeNotFoundException- If the node doesn't exist (404)NonSwarmNodeException- If the node is not part of a swarm (503)DockerException- If a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
deleteNode
public void deleteNode(java.lang.String nodeId) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientRemove a node from the swarm.- Specified by:
deleteNodein interfaceDockerClient- Parameters:
nodeId- The id of the node to remove.- Throws:
DockerExceptionjava.lang.InterruptedException
-
deleteNode
public void deleteNode(java.lang.String nodeId, boolean force) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientRemove a node from the swarm.- Specified by:
deleteNodein interfaceDockerClient- Parameters:
nodeId- The id of the node to remove.force- Forcefully remove the node.- Throws:
DockerExceptionjava.lang.InterruptedException
-
execResizeTty
public void execResizeTty(java.lang.String execId, java.lang.Integer height, java.lang.Integer width) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientResizes the tty session used by an exec command. This API is valid only ifttywas specified as part ofcreatingandstartingthe exec command.- Specified by:
execResizeTtyin interfaceDockerClient- Parameters:
execId- exec idheight- height of tty sessionwidth- width of tty session- Throws:
BadParamException- if both height and width are null or zeroExecNotFoundException- if exec instance is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
execInspect
public ExecState execInspect(java.lang.String execId) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientInspects a running or previously run exec instance id.- Specified by:
execInspectin interfaceDockerClient- Parameters:
execId- exec id- Returns:
- state of this exec instance.
- Throws:
ExecNotFoundException- if exec instance is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
stats
public ContainerStats stats(java.lang.String containerId) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientRetrieves one-time stats (stream=0) for the container with the specified id.- Specified by:
statsin interfaceDockerClient- Parameters:
containerId- The id of the container to retrieve stats for.- Returns:
- The container stats
- Throws:
ContainerNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
resizeTty
public void resizeTty(java.lang.String containerId, java.lang.Integer height, java.lang.Integer width) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientResize container TTY This API is valid only ifttywas specified as part ofcreatingthe container.- Specified by:
resizeTtyin interfaceDockerClient- Parameters:
containerId- The id of the container whose TTY will be resized.height- New height of TTYwidth- New width of TTY- Throws:
BadParamException- if both height and width are null or zeroContainerNotFoundException- if container is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
checkTtyParams
private void checkTtyParams(java.lang.Integer height, java.lang.Integer width) throws BadParamException- Throws:
BadParamException
-
listNetworks
public java.util.List<Network> listNetworks(DockerClient.ListNetworksParam... params) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientList all or a subset of the networks. Filters were added in Docker 1.10, API version 1.22.- Specified by:
listNetworksin interfaceDockerClient- Returns:
- networks
- Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
inspectNetwork
public Network inspectNetwork(java.lang.String networkId) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientInspect a specific network.- Specified by:
inspectNetworkin interfaceDockerClient- Parameters:
networkId- The id of the network- Returns:
- network information
- Throws:
NetworkNotFoundException- if network is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
createNetwork
public NetworkCreation createNetwork(NetworkConfig networkConfig) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientCreate a new network.- Specified by:
createNetworkin interfaceDockerClient- Parameters:
networkConfig- The network creation parameters- Returns:
- NetworkCreation
- Throws:
NetworkNotFoundException- if network is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
removeNetwork
public void removeNetwork(java.lang.String networkId) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientRemove a docker network.- Specified by:
removeNetworkin interfaceDockerClient- Parameters:
networkId- The id of the network to remove.- Throws:
NetworkNotFoundException- if network is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
connectToNetwork
public void connectToNetwork(java.lang.String containerId, java.lang.String networkId) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientConnects a docker container to a network.- Specified by:
connectToNetworkin interfaceDockerClient- Parameters:
containerId- The id of the container to connect.networkId- The id of the network to connect.- Throws:
NotFoundException- if either container or network is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
connectToNetwork
public void connectToNetwork(java.lang.String networkId, NetworkConnection networkConnection) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientConnects a docker container to a network, with extended configuration. This is useful when you want to set specific details (aliases, gateway, etc...) for your container inside the network.- Specified by:
connectToNetworkin interfaceDockerClient- Parameters:
networkId- The id of the network to connect.networkConnection- The target connection parameters.- Throws:
NotFoundException- if either container or network is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- if the thread is interrupted
-
disconnectFromNetwork
public void disconnectFromNetwork(java.lang.String containerId, java.lang.String networkId) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientDisconnects a docker container to a network.- Specified by:
disconnectFromNetworkin interfaceDockerClient- Parameters:
containerId- The id of the container to disconnect.networkId- The id of the network to disconnect.- Throws:
NotFoundException- if either container or network is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
disconnectFromNetwork
public void disconnectFromNetwork(java.lang.String containerId, java.lang.String networkId, boolean force) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientDisconnects a docker container to a network.- Specified by:
disconnectFromNetworkin interfaceDockerClient- Parameters:
containerId- The id of the container to disconnect.networkId- The id of the network to disconnect.force- Force the container to disconnect from the network.- Throws:
NotFoundException- if either container or network is not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException- If the thread is interrupted
-
createVolume
public Volume createVolume() throws DockerException, java.lang.InterruptedException
- Specified by:
createVolumein interfaceDockerClient- Throws:
DockerExceptionjava.lang.InterruptedException
-
createVolume
public Volume createVolume(Volume volume) throws DockerException, java.lang.InterruptedException
- Specified by:
createVolumein interfaceDockerClient- Throws:
DockerExceptionjava.lang.InterruptedException
-
inspectVolume
public Volume inspectVolume(java.lang.String volumeName) throws DockerException, java.lang.InterruptedException
- Specified by:
inspectVolumein interfaceDockerClient- Throws:
DockerExceptionjava.lang.InterruptedException
-
removeVolume
public void removeVolume(Volume volume) throws DockerException, java.lang.InterruptedException
- Specified by:
removeVolumein interfaceDockerClient- Throws:
DockerExceptionjava.lang.InterruptedException
-
removeVolume
public void removeVolume(java.lang.String volumeName) throws DockerException, java.lang.InterruptedException- Specified by:
removeVolumein interfaceDockerClient- Throws:
DockerExceptionjava.lang.InterruptedException
-
listVolumes
public VolumeList listVolumes(DockerClient.ListVolumesParam... params) throws DockerException, java.lang.InterruptedException
- Specified by:
listVolumesin interfaceDockerClient- Throws:
DockerExceptionjava.lang.InterruptedException
-
listSecrets
public java.util.List<Secret> listSecrets() throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientList secrets.- Specified by:
listSecretsin interfaceDockerClient- Returns:
- A list of
Secrets - Throws:
DockerException- if a server error occurred (500)java.lang.InterruptedException
-
createSecret
public SecretCreateResponse createSecret(SecretSpec secret) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientCreate a secret.- Specified by:
createSecretin interfaceDockerClient- Parameters:
secret- The spec for the secret.- Returns:
SecretCreateResponse- Throws:
ConflictException- conflict (409)DockerException- if node is not part of a swarm (406) or a server error occurred (500)java.lang.InterruptedException
-
inspectSecret
public Secret inspectSecret(java.lang.String secretId) throws DockerException, java.lang.InterruptedException
Description copied from interface:DockerClientInspect a secret.- Specified by:
inspectSecretin interfaceDockerClient- Parameters:
secretId- The id of the secret.- Returns:
Secret- Throws:
NotFoundException- secret not found (404)DockerException- if node is not part of a swarm (406) or a server error occurred (500)java.lang.InterruptedException
-
deleteSecret
public void deleteSecret(java.lang.String secretId) throws DockerException, java.lang.InterruptedExceptionDescription copied from interface:DockerClientDelete a secret.- Specified by:
deleteSecretin interfaceDockerClient- Parameters:
secretId- The id of the secret.- Throws:
NotFoundException- not found (404)DockerException- if a server error occurred (500)java.lang.InterruptedException
-
resource
private javax.ws.rs.client.WebTarget resource()
-
noTimeoutResource
private javax.ws.rs.client.WebTarget noTimeoutResource()
-
request
private <T> T request(java.lang.String method, javax.ws.rs.core.GenericType<T> type, javax.ws.rs.client.WebTarget resource, javax.ws.rs.client.Invocation.Builder request) throws DockerException, java.lang.InterruptedException- Throws:
DockerExceptionjava.lang.InterruptedException
-
request
private <T> T request(java.lang.String method, java.lang.Class<T> clazz, javax.ws.rs.client.WebTarget resource, javax.ws.rs.client.Invocation.Builder request) throws DockerException, java.lang.InterruptedException- Throws:
DockerExceptionjava.lang.InterruptedException
-
request
private <T> T request(java.lang.String method, java.lang.Class<T> clazz, javax.ws.rs.client.WebTarget resource, javax.ws.rs.client.Invocation.Builder request, javax.ws.rs.client.Entity<?> entity) throws DockerException, java.lang.InterruptedException- Throws:
DockerExceptionjava.lang.InterruptedException
-
request
private void request(java.lang.String method, javax.ws.rs.client.WebTarget resource, javax.ws.rs.client.Invocation.Builder request) throws DockerException, java.lang.InterruptedException- Throws:
DockerExceptionjava.lang.InterruptedException
-
tailResponse
private void tailResponse(java.lang.String method, javax.ws.rs.core.Response response, ProgressHandler handler, javax.ws.rs.client.WebTarget resource) throws DockerException, java.lang.InterruptedException- Throws:
DockerExceptionjava.lang.InterruptedException
-
requestAndTail
private void requestAndTail(java.lang.String method, ProgressHandler handler, javax.ws.rs.client.WebTarget resource, javax.ws.rs.client.Invocation.Builder request, javax.ws.rs.client.Entity<?> entity) throws DockerException, java.lang.InterruptedException- Throws:
DockerExceptionjava.lang.InterruptedException
-
requestAndTail
private void requestAndTail(java.lang.String method, ProgressHandler handler, javax.ws.rs.client.WebTarget resource, javax.ws.rs.client.Invocation.Builder request) throws DockerException, java.lang.InterruptedException- Throws:
DockerExceptionjava.lang.InterruptedException
-
headers
private javax.ws.rs.client.Invocation.Builder headers(javax.ws.rs.client.Invocation.Builder request)
-
propagate
private java.lang.RuntimeException propagate(java.lang.String method, javax.ws.rs.client.WebTarget resource, java.lang.Exception ex) throws DockerException, java.lang.InterruptedException- Throws:
DockerExceptionjava.lang.InterruptedException
-
message
private java.lang.String message(javax.ws.rs.core.Response response)
-
authHeader
private java.lang.String authHeader(RegistryAuth registryAuth) throws DockerException
- Throws:
DockerException
-
authRegistryHeader
private java.lang.String authRegistryHeader(RegistryConfigs registryConfigs) throws DockerException
- Throws:
DockerException
-
assertApiVersionIsAbove
private void assertApiVersionIsAbove(java.lang.String minimumVersion) throws DockerException, java.lang.InterruptedException- Throws:
DockerExceptionjava.lang.InterruptedException
-
builder
public static DefaultDockerClient.Builder builder()
Create a newDefaultDockerClientbuilder.- Returns:
- Returns a builder that can be used to further customize and then build the client.
-
fromEnv
public static DefaultDockerClient.Builder fromEnv() throws DockerCertificateException
Create a newDefaultDockerClientbuilder prepopulated with values loaded from the DOCKER_HOST and DOCKER_CERT_PATH environment variables.- Returns:
- Returns a builder that can be used to further customize and then build the client.
- Throws:
DockerCertificateException- if we could not build a DockerCertificates object
-
-