Interface DockerClient

  • All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable
    All Known Implementing Classes:
    DefaultDockerClient

    public interface DockerClient
    extends java.io.Closeable
    A client for interacting with dockerd.

    Note: All methods throw DockerException on unexpected docker response status codes.

    • Method Detail

      • ping

        java.lang.String ping()
                       throws DockerException,
                              java.lang.InterruptedException
        Ping the docker daemon. Returns "OK" if all is well, though that it simply returns a 200 status is probably sufficient information.
        Returns:
        String "OK"
        Throws:
        DockerException - if a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • version

        Version version()
                 throws DockerException,
                        java.lang.InterruptedException
        Get the docker version.
        Returns:
        docker version
        Throws:
        DockerException - if a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • auth

        int auth​(RegistryAuth registryAuth)
          throws DockerException,
                 java.lang.InterruptedException
        Check auth configuration.
        Parameters:
        registryAuth - The RegistryAuth needed 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

        Info info()
           throws DockerException,
                  java.lang.InterruptedException
        Get docker instance information.
        Returns:
        docker info
        Throws:
        DockerException - if a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • listContainers

        java.util.List<Container> listContainers​(DockerClient.ListContainersParam... params)
                                          throws DockerException,
                                                 java.lang.InterruptedException
        List docker containers.
        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
      • listImages

        java.util.List<Image> listImages​(DockerClient.ListImagesParam... params)
                                  throws DockerException,
                                         java.lang.InterruptedException
        List docker images.
        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
      • inspectContainer

        ContainerInfo inspectContainer​(java.lang.String containerId)
                                throws DockerException,
                                       java.lang.InterruptedException
        Inspect a docker container.
        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

        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
        Create a new image from a container's changes.
        Parameters:
        containerId - The id of the container to commit.
        comment - commit message.
        author - image author.
        tag - image tag.
        repo - repository to commit to.
        config - ContainerConfig to commit.
        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
      • inspectImage

        ImageInfo inspectImage​(java.lang.String image)
                        throws DockerException,
                               java.lang.InterruptedException
        Inspect a docker container image.
        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

        java.util.List<RemovedImage> removeImage​(java.lang.String image)
                                          throws DockerException,
                                                 java.lang.InterruptedException
        Remove a docker image.
        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

        java.util.List<RemovedImage> removeImage​(java.lang.String image,
                                                 boolean force,
                                                 boolean noPrune)
                                          throws DockerException,
                                                 java.lang.InterruptedException
        Remove a docker image.
        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
      • searchImages

        java.util.List<ImageSearchResult> searchImages​(java.lang.String term)
                                                throws DockerException,
                                                       java.lang.InterruptedException
        Search for images on Docker Hub

        This method is broken for Docker 1.7.x because of a Docker bug. See https://github.com/docker/docker/pull/14850.

        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
        void load​(java.lang.String image,
                  java.io.InputStream imagePayload)
           throws DockerException,
                  java.lang.InterruptedException
        Deprecated.
        Use load(InputStream) to load a set of image layers from a tarball. Use create(String, InputStream) to create a single image from the contents of a tarball.
        Creates a single image from a tarball. This method also tags the image with the given image name upon loading completion.
        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
        void load​(java.lang.String image,
                  java.io.InputStream imagePayload,
                  ProgressHandler handler)
           throws DockerException,
                  java.lang.InterruptedException
        Deprecated.
        Use load(InputStream) to load a set of image layers from a tarball. Use create(String, InputStream, ProgressHandler) to create a single image from the contents of a tarball.
        Creates a single image from a tarball. This method also tags the image with the given image name upon loading completion.
        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

        java.util.Set<java.lang.String> load​(java.io.InputStream imagePayload)
                                      throws DockerException,
                                             java.lang.InterruptedException
        Load a set of images and tags from a tarball.
        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

        java.util.Set<java.lang.String> load​(java.io.InputStream imagePayload,
                                             ProgressHandler handler)
                                      throws DockerException,
                                             java.lang.InterruptedException
        Load a set of images and tags from a tarball, using a custom ProgressMessageHandler.
        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

        void create​(java.lang.String image,
                    java.io.InputStream imagePayload)
             throws DockerException,
                    java.lang.InterruptedException
        Creates a single image from a tarball. This method also tags the image with the given image name upon loading completion.
        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

        void create​(java.lang.String image,
                    java.io.InputStream imagePayload,
                    ProgressHandler handler)
             throws DockerException,
                    java.lang.InterruptedException
        Creates a single image from a tarball. This method also tags the image with the given image name upon loading completion.
        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

        java.io.InputStream save​(java.lang.String... images)
                          throws DockerException,
                                 java.io.IOException,
                                 java.lang.InterruptedException
        Get a tarball containing all images and metadata for the repository specified.
        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

        java.io.InputStream saveMultiple​(java.lang.String... images)
                                  throws DockerException,
                                         java.io.IOException,
                                         java.lang.InterruptedException
        Get a tarball containing all images and metadata for one or more repositories.
        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.
      • topContainer

        TopResults topContainer​(java.lang.String containerId)
                         throws DockerException,
                                java.lang.InterruptedException
        List processes running inside the container by using ps.
        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

        TopResults topContainer​(java.lang.String containerId,
                                java.lang.String psArgs)
                         throws DockerException,
                                java.lang.InterruptedException
        List processes running inside the container using ps and the given arguments.
        Parameters:
        containerId - the id of the container to examine
        psArgs - the arguments to pass to ps inside 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.
      • pull

        void pull​(java.lang.String image)
           throws DockerException,
                  java.lang.InterruptedException
        Pull a docker container image.
        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

        void pull​(java.lang.String image,
                  ProgressHandler handler)
           throws DockerException,
                  java.lang.InterruptedException
        Pull a docker container image, using a custom ProgressMessageHandler
        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

        void pull​(java.lang.String image,
                  RegistryAuth registryAuth)
           throws DockerException,
                  java.lang.InterruptedException
        Pull a private docker container image.
        Parameters:
        image - The image to pull.
        registryAuth - The RegistryAuth needed 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

        void pull​(java.lang.String image,
                  RegistryAuth registryAuth,
                  ProgressHandler handler)
           throws DockerException,
                  java.lang.InterruptedException
        Pull a private docker container image, using a custom ProgressMessageHandler.
        Parameters:
        image - The image to pull.
        registryAuth - The RegistryAuth needed 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

        void push​(java.lang.String image)
           throws DockerException,
                  java.lang.InterruptedException
        Push a docker container image.
        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

        void push​(java.lang.String image,
                  ProgressHandler handler)
           throws DockerException,
                  java.lang.InterruptedException
        Push a docker container image, using a custom ProgressHandler
        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
      • tag

        void tag​(java.lang.String image,
                 java.lang.String name)
          throws DockerException,
                 java.lang.InterruptedException
        Tag a docker image.
        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

        void tag​(java.lang.String image,
                 java.lang.String name,
                 boolean force)
          throws DockerException,
                 java.lang.InterruptedException
        Tag a docker image.
        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

        java.lang.String build​(java.nio.file.Path directory,
                               DockerClient.BuildParam... params)
                        throws DockerException,
                               java.lang.InterruptedException,
                               java.io.IOException
        Build a docker image.
        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 interrupted
        java.io.IOException - If some IO shit happened.
      • build

        java.lang.String build​(java.nio.file.Path directory,
                               java.lang.String name,
                               DockerClient.BuildParam... params)
                        throws DockerException,
                               java.lang.InterruptedException,
                               java.io.IOException
        Build a docker image.
        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 interrupted
        java.io.IOException - If some IO shit happened.
      • build

        java.lang.String build​(java.nio.file.Path directory,
                               ProgressHandler handler,
                               DockerClient.BuildParam... params)
                        throws DockerException,
                               java.lang.InterruptedException,
                               java.io.IOException
        Build a docker image.
        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 interrupted
        java.io.IOException - If some IO shit happened.
      • build

        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.IOException
        Build a docker image.
        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 interrupted
        java.io.IOException - If some IO shit happened.
      • build

        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.IOException
        Build a docker image.
        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 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 interrupted
        java.io.IOException - If some IO shit happened.
      • history

        java.util.List<ImageHistory> history​(java.lang.String image)
                                      throws java.lang.InterruptedException,
                                             DockerException
        Return the history of the image.
        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
      • createContainer

        ContainerCreation createContainer​(ContainerConfig config)
                                   throws DockerException,
                                          java.lang.InterruptedException
        Create a docker container.
        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

        ContainerCreation createContainer​(ContainerConfig config,
                                          java.lang.String name)
                                   throws DockerException,
                                          java.lang.InterruptedException
        Create a docker container.
        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
      • renameContainer

        void renameContainer​(java.lang.String containerId,
                             java.lang.String name)
                      throws DockerException,
                             java.lang.InterruptedException
        Rename a docker container.
        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

        ContainerUpdate updateContainer​(java.lang.String containerId,
                                        HostConfig config)
                                 throws DockerException,
                                        java.lang.InterruptedException
        Update an existing container. Only available in Docker API >= 1.22.
        Parameters:
        containerId - the identifier of the container
        config - the new container host config
        Throws:
        DockerException - if a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • startContainer

        void startContainer​(java.lang.String containerId)
                     throws DockerException,
                            java.lang.InterruptedException
        Start a docker container.
        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
      • stopContainer

        void stopContainer​(java.lang.String containerId,
                           int secondsToWaitBeforeKilling)
                    throws DockerException,
                           java.lang.InterruptedException
        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.
        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
      • pauseContainer

        void pauseContainer​(java.lang.String containerId)
                     throws DockerException,
                            java.lang.InterruptedException
        Pause a docker container.
        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

        void unpauseContainer​(java.lang.String containerId)
                       throws DockerException,
                              java.lang.InterruptedException
        Unpause a docker container.
        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

        void restartContainer​(java.lang.String containerId)
                       throws DockerException,
                              java.lang.InterruptedException
        Restart a docker container. with a 10 second default wait
        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

        void restartContainer​(java.lang.String containerId,
                              int secondsToWaitBeforeRestart)
                       throws DockerException,
                              java.lang.InterruptedException
        Restart a docker container.
        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
      • waitContainer

        ContainerExit waitContainer​(java.lang.String containerId)
                             throws DockerException,
                                    java.lang.InterruptedException
        Wait for a docker container to exit.
        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
      • killContainer

        void killContainer​(java.lang.String containerId)
                    throws DockerException,
                           java.lang.InterruptedException
        Kill a docker container. Note: by default SIGKILL is sent.
        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

        void killContainer​(java.lang.String containerId,
                           DockerClient.Signal signal)
                    throws DockerException,
                           java.lang.InterruptedException
        Kill a docker container.
        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

        Distribution getDistribution​(java.lang.String imageName)
                              throws DockerException,
                                     java.lang.InterruptedException
        Get the distribution of a container.
        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
      • removeContainer

        void removeContainer​(java.lang.String containerId)
                      throws DockerException,
                             java.lang.InterruptedException
        Remove a docker container.
        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
        void removeContainer​(java.lang.String containerId,
                             boolean removeVolumes)
                      throws DockerException,
                             java.lang.InterruptedException
        Remove a docker container.
        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
      • exportContainer

        java.io.InputStream exportContainer​(java.lang.String containerId)
                                     throws DockerException,
                                            java.lang.InterruptedException
        Export a docker container as a tar archive.
        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
        java.io.InputStream copyContainer​(java.lang.String containerId,
                                          java.lang.String path)
                                   throws DockerException,
                                          java.lang.InterruptedException
        Deprecated.
        Replaced by archiveContainer(String, String) in API 1.20, removed in 1.24.
        Copies some files out of a container. (removed on API version 1.24)
        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 called share in the tar archive). The directory name is completely resolved, so copying "/usr/share/././." will still create a directory called "share" in the tar archive. If a single file was copied, that file will be the sole entry in the tar archive. Copying "." or equivalently "/" will result in the tar archive containing a single folder named after the container ID.
        Throws:
        ContainerNotFoundException - if container is not found (404)
        DockerException - if a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
        UnsupportedApiVersionException - If client API is greater than or equal to 1.24
      • archiveContainer

        java.io.InputStream archiveContainer​(java.lang.String containerId,
                                             java.lang.String path)
                                      throws DockerException,
                                             java.lang.InterruptedException
        Copies an archive out of a container. (API version 1.20+)
        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 called share in the tar archive). The directory name is completely resolved, so copying "/usr/share/././." will still create a directory called "share" in the tar archive. If a single file was copied, that file will be the sole entry in the tar archive. Copying "." or equivalently "/" will result in the tar archive containing a single folder named after the container ID.
        Throws:
        ContainerNotFoundException - if container is not found (404)
        DockerException - if a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
        Since:
        1.20
      • copyToContainer

        void copyToContainer​(java.nio.file.Path directory,
                             java.lang.String containerId,
                             java.lang.String path)
                      throws DockerException,
                             java.lang.InterruptedException,
                             java.io.IOException
        Copies some files from host to container. (API version 1.20+)
        Parameters:
        directory - The path to sent to container
        containerId - 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 interrupted
        java.io.IOException - If IOException
        Since:
        1.20
      • copyToContainer

        void copyToContainer​(java.io.InputStream tarStream,
                             java.lang.String containerId,
                             java.lang.String path)
                      throws DockerException,
                             java.lang.InterruptedException,
                             java.io.IOException
        Throws:
        DockerException
        java.lang.InterruptedException
        java.io.IOException
      • inspectContainerChanges

        java.util.List<ContainerChange> inspectContainerChanges​(java.lang.String containerId)
                                                         throws DockerException,
                                                                java.lang.InterruptedException
        Inspect changes on a container's filesystem.
        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
      • logs

        LogStream logs​(java.lang.String containerId,
                       DockerClient.LogsParam... params)
                throws DockerException,
                       java.lang.InterruptedException
        Get docker container logs.
        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

        EventStream events​(DockerClient.EventsParam... params)
                    throws DockerException,
                           java.lang.InterruptedException
        Watches 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.

        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
      • execCreate

        ExecCreation execCreate​(java.lang.String containerId,
                                java.lang.String[] cmd,
                                DockerClient.ExecCreateParam... params)
                         throws DockerException,
                                java.lang.InterruptedException
        Sets up an exec instance in a running container id.
        Parameters:
        containerId - The id of the container
        cmd - shell command
        params - Exec params
        Returns:
        ExecCreation
        Throws:
        DockerException - if a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • execStart

        LogStream execStart​(java.lang.String execId,
                            DockerClient.ExecStartParameter... params)
                     throws DockerException,
                            java.lang.InterruptedException
        Starts 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.
        Parameters:
        execId - exec id
        params - 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

        Swarm inspectSwarm()
                    throws DockerException,
                           java.lang.InterruptedException
        Inspect the swarm. Only available in Docker API >= 1.24.
        Returns:
        Info about a swarm
        Throws:
        DockerException - If a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • initSwarm

        java.lang.String initSwarm​(SwarmInit swarmInit)
                            throws DockerException,
                                   java.lang.InterruptedException
        Initialize a new swarm. Only available in Docker API >= 1.24.
        Returns:
        Node ID
        Throws:
        DockerException - If a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • joinSwarm

        void joinSwarm​(SwarmJoin swarmJoin)
                throws DockerException,
                       java.lang.InterruptedException
        Join an existing swarm. Only available in Docker API >= 1.24.
        Throws:
        DockerException - If a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • leaveSwarm

        void leaveSwarm()
                 throws DockerException,
                        java.lang.InterruptedException
        Leave a swarm. Only available in Docker API >= 1.24.
        Throws:
        DockerException - If a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • leaveSwarm

        void leaveSwarm​(boolean force)
                 throws DockerException,
                        java.lang.InterruptedException
        Leave 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.
        Parameters:
        force - Whether to leave forcefully
        Throws:
        DockerException - If a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • updateSwarm

        void updateSwarm​(java.lang.Long version,
                         boolean rotateWorkerToken,
                         boolean rotateManagerToken,
                         boolean rotateManagerUnlockKey,
                         SwarmSpec spec)
                  throws DockerException,
                         java.lang.InterruptedException
        Update a swarm. Only available in Docker API >= 1.24.
        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

        void updateSwarm​(java.lang.Long version,
                         boolean rotateWorkerToken,
                         boolean rotateManagerToken,
                         SwarmSpec spec)
                  throws DockerException,
                         java.lang.InterruptedException
        Update a swarm. Only available in Docker API >= 1.24.
        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

        void updateSwarm​(java.lang.Long version,
                         boolean rotateWorkerToken,
                         SwarmSpec spec)
                  throws DockerException,
                         java.lang.InterruptedException
        Update a swarm. Only available in Docker API >= 1.24.
        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

        void updateSwarm​(java.lang.Long version,
                         SwarmSpec spec)
                  throws DockerException,
                         java.lang.InterruptedException
        Update a swarm. Only available in Docker API >= 1.24.
        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

        UnlockKey unlockKey()
                     throws DockerException,
                            java.lang.InterruptedException
        Get an unlock key for unlocking a swarm. Only available in Docker API >= 1.25.
        Returns:
        UnlockKey
        Throws:
        DockerException - If a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • unlock

        void unlock​(UnlockKey unlockKey)
             throws DockerException,
                    java.lang.InterruptedException
        Unlock a swarm. Only available in Docker API >= 1.25.
        Parameters:
        unlockKey - UnlockKey
        Throws:
        DockerException - If a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • createService

        ServiceCreateResponse createService​(ServiceSpec spec)
                                     throws DockerException,
                                            java.lang.InterruptedException
        Create a new service. Only available in Docker API >= 1.24.
        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

        ServiceCreateResponse createService​(ServiceSpec spec,
                                            RegistryAuth registryAuth)
                                     throws DockerException,
                                            java.lang.InterruptedException
        Create a new service. Only available in Docker API >= 1.24.
        Parameters:
        spec - the service spec
        registryAuth - 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

        Service inspectService​(java.lang.String serviceId)
                        throws DockerException,
                               java.lang.InterruptedException
        Inspect an existing service. Only available in Docker API >= 1.24.
        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

        void updateService​(java.lang.String serviceId,
                           java.lang.Long version,
                           ServiceSpec spec)
                    throws DockerException,
                           java.lang.InterruptedException
        Update an existing service. Only available in Docker API >= 1.24.
        Parameters:
        serviceId - the identifier of the service
        version - the version of the service
        spec - the new service spec
        Throws:
        DockerException - if a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • updateService

        void updateService​(java.lang.String serviceId,
                           java.lang.Long version,
                           ServiceSpec spec,
                           RegistryAuth registryAuth)
                    throws DockerException,
                           java.lang.InterruptedException
        Update an existing service. Only available in Docker API >= 1.24.
        Parameters:
        serviceId - the identifier of the service
        version - the version of the service
        spec - the new service spec
        registryAuth - the registry authentication configuration
        Throws:
        DockerException - if a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • listServices

        java.util.List<Service> listServices()
                                      throws DockerException,
                                             java.lang.InterruptedException
        List all services. Only available in Docker API >= 1.24.
        Returns:
        A list of services.
        Throws:
        DockerException - if a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • listServices

        java.util.List<Service> listServices​(Service.Criteria criteria)
                                      throws DockerException,
                                             java.lang.InterruptedException
        List services that match the given criteria. Only available in Docker API >= 1.24.
        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

        void removeService​(java.lang.String serviceId)
                    throws DockerException,
                           java.lang.InterruptedException
        Remove an existing service. Only available in Docker API >= 1.24.
        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

        LogStream serviceLogs​(java.lang.String serviceId,
                              DockerClient.LogsParam... params)
                       throws DockerException,
                              java.lang.InterruptedException
        Get docker service logs.
        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

        Task inspectTask​(java.lang.String taskId)
                  throws DockerException,
                         java.lang.InterruptedException
        Inspect an existing task. Only available in Docker API >= 1.24.
        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

        java.util.List<Task> listTasks()
                                throws DockerException,
                                       java.lang.InterruptedException
        List all tasks. Only available in Docker API >= 1.24.
        Returns:
        A list of tasks.
        Throws:
        DockerException - if a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • listTasks

        java.util.List<Task> listTasks​(Task.Criteria criteria)
                                throws DockerException,
                                       java.lang.InterruptedException
        List tasks that match the given criteria. Only available in Docker API >= 1.24.
        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
      • execResizeTty

        void execResizeTty​(java.lang.String execId,
                           java.lang.Integer height,
                           java.lang.Integer width)
                    throws DockerException,
                           java.lang.InterruptedException
        Resizes the tty session used by an exec command. This API is valid only if tty was specified as part of creating and starting the exec command.
        Parameters:
        execId - exec id
        height - height of tty session
        width - width of tty session
        Throws:
        BadParamException - if both height and width are null or zero
        ExecNotFoundException - if exec instance is not found (404)
        DockerException - if a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • execInspect

        ExecState execInspect​(java.lang.String execId)
                       throws DockerException,
                              java.lang.InterruptedException
        Inspects a running or previously run exec instance id.
        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

        ContainerStats stats​(java.lang.String containerId)
                      throws DockerException,
                             java.lang.InterruptedException
        Retrieves one-time stats (stream=0) for the container with the specified id.
        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

        void resizeTty​(java.lang.String containerId,
                       java.lang.Integer height,
                       java.lang.Integer width)
                throws DockerException,
                       java.lang.InterruptedException
        Resize container TTY This API is valid only if tty was specified as part of creating the container.
        Parameters:
        containerId - The id of the container whose TTY will be resized.
        height - New height of TTY
        width - New width of TTY
        Throws:
        BadParamException - if both height and width are null or zero
        ContainerNotFoundException - if container is not found (404)
        DockerException - if a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • listNetworks

        java.util.List<Network> listNetworks​(DockerClient.ListNetworksParam... params)
                                      throws DockerException,
                                             java.lang.InterruptedException
        List all or a subset of the networks. Filters were added in Docker 1.10, API version 1.22.
        Returns:
        networks
        Throws:
        DockerException - if a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
      • inspectNetwork

        Network inspectNetwork​(java.lang.String networkId)
                        throws DockerException,
                               java.lang.InterruptedException
        Inspect a specific network.
        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

        NetworkCreation createNetwork​(NetworkConfig networkConfig)
                               throws DockerException,
                                      java.lang.InterruptedException
        Create a new network.
        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

        void removeNetwork​(java.lang.String networkId)
                    throws DockerException,
                           java.lang.InterruptedException
        Remove a docker network.
        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

        void connectToNetwork​(java.lang.String containerId,
                              java.lang.String networkId)
                       throws DockerException,
                              java.lang.InterruptedException
        Connects a docker container to a network.
        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

        void connectToNetwork​(java.lang.String networkId,
                              NetworkConnection networkConnection)
                       throws DockerException,
                              java.lang.InterruptedException
        Connects 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.
        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

        void disconnectFromNetwork​(java.lang.String containerId,
                                   java.lang.String networkId)
                            throws DockerException,
                                   java.lang.InterruptedException
        Disconnects a docker container to a network.
        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

        void disconnectFromNetwork​(java.lang.String containerId,
                                   java.lang.String networkId,
                                   boolean force)
                            throws DockerException,
                                   java.lang.InterruptedException
        Disconnects a docker container to a network.
        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
      • close

        void close()
        Closes any and all underlying connections to docker, and release resources.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
      • attachContainer

        LogStream attachContainer​(java.lang.String containerId,
                                  DockerClient.AttachParameter... params)
                           throws DockerException,
                                  java.lang.InterruptedException
        Attach to the container id.
        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
        java.lang.IllegalStateException - If the container is not running
      • getHost

        java.lang.String getHost()
        Get the Docker host address.
        Returns:
        the docker host name or IP
      • inspectVolume

        Volume inspectVolume​(java.lang.String volumeName)
                      throws DockerException,
                             java.lang.InterruptedException
        Throws:
        DockerException
        java.lang.InterruptedException
      • removeVolume

        void removeVolume​(java.lang.String volumeName)
                   throws DockerException,
                          java.lang.InterruptedException
        Throws:
        DockerException
        java.lang.InterruptedException
      • listSecrets

        java.util.List<Secret> listSecrets()
                                    throws DockerException,
                                           java.lang.InterruptedException
        List secrets.
        Returns:
        A list of Secrets
        Throws:
        DockerException - if a server error occurred (500)
        java.lang.InterruptedException
        Since:
        Docker 1.13, API version 1.25
      • inspectSecret

        Secret inspectSecret​(java.lang.String secretId)
                      throws DockerException,
                             java.lang.InterruptedException
        Inspect a secret.
        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
        Since:
        Docker 1.13, API version 1.25
      • deleteSecret

        void deleteSecret​(java.lang.String secretId)
                   throws DockerException,
                          java.lang.InterruptedException
        Delete a secret.
        Parameters:
        secretId - The id of the secret.
        Throws:
        NotFoundException - not found (404)
        DockerException - if a server error occurred (500)
        java.lang.InterruptedException
        Since:
        Docker 1.13, API version 1.25
      • listConfigs

        java.util.List<Config> listConfigs()
                                    throws DockerException,
                                           java.lang.InterruptedException
        List swarm configs. Only available in Docker API >= 1.30.
        Returns:
        a list of configs
        Throws:
        DockerException - if a server error occurred (500)
        java.lang.InterruptedException - if the thread is interrupted
        Since:
        Docker 1.13, API version 1.30
      • listConfigs

        java.util.List<Config> listConfigs​(Config.Criteria criteria)
                                    throws DockerException,
                                           java.lang.InterruptedException
        List swarm configs. Only available in Docker API >= 1.30.
        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
        Since:
        Docker 1.13, API version 1.30
      • inspectConfig

        Config inspectConfig​(java.lang.String configId)
                      throws DockerException,
                             java.lang.InterruptedException
        Inspect a config. Only available in Docker API >= 1.30.
        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
        Since:
        Docker 1.13, API version 1.30
      • deleteConfig

        void deleteConfig​(java.lang.String configId)
                   throws DockerException,
                          java.lang.InterruptedException
        Delete a config. Only available in Docker API >= 1.30.
        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
        Since:
        Docker 1.13, API version 1.30
      • updateConfig

        void updateConfig​(java.lang.String configId,
                          java.lang.Long version,
                          ConfigSpec nodeSpec)
                   throws DockerException,
                          java.lang.InterruptedException
        Update a swarm config. Only available in Docker API >= 1.30.
        Parameters:
        configId - The id of the config to update
        version - 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
        Since:
        Docker 1.13, API version 1.30
      • listNodes

        java.util.List<Node> listNodes()
                                throws DockerException,
                                       java.lang.InterruptedException
        List swarm nodes. Only available in Docker API >= 1.24.
        Returns:
        A list of nodes.
        Throws:
        DockerException - if a server error occurred (500)
        java.lang.InterruptedException - If the thread is interrupted
        Since:
        Docker 1.12, API version 1.24
      • listNodes

        java.util.List<Node> listNodes​(Node.Criteria criteria)
                                throws DockerException,
                                       java.lang.InterruptedException
        List swarm nodes that match the given criteria. Only available in Docker API >= 1.24.
        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
        Since:
        Docker 1.12, API version 1.24
      • inspectNode

        NodeInfo inspectNode​(java.lang.String nodeId)
                      throws DockerException,
                             java.lang.InterruptedException
        Inspects a swarm node. Only available in Docker API >= 1.24.
        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
        Since:
        Docker 1.12, API Version 1.24
      • updateNode

        void updateNode​(java.lang.String nodeId,
                        java.lang.Long version,
                        NodeSpec nodeSpec)
                 throws DockerException,
                        java.lang.InterruptedException
        Update a swarm node. Only available in Docker API >= 1.24.
        Parameters:
        nodeId - The id of the node to update
        version - 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
        Since:
        Docker 1.12, API version 1.24
      • deleteNode

        void deleteNode​(java.lang.String nodeId)
                 throws DockerException,
                        java.lang.InterruptedException
        Remove a node from the swarm.
        Parameters:
        nodeId - The id of the node to remove.
        Throws:
        DockerException
        java.lang.InterruptedException
      • deleteNode

        void deleteNode​(java.lang.String nodeId,
                        boolean force)
                 throws DockerException,
                        java.lang.InterruptedException
        Remove a node from the swarm.
        Parameters:
        nodeId - The id of the node to remove.
        force - Forcefully remove the node.
        Throws:
        DockerException
        java.lang.InterruptedException