docker: Index | Files

package client

import ""

Package client provides a command-line interface for Docker.

Run "docker help SUBCOMMAND" or "docker SUBCOMMAND --help" to see more information on any Docker subcommand, including the full list of options supported for the subcommand. See for instructions on installing Docker.


Package Files

attach.go build.go cli.go client.go commit.go cp.go create.go diff.go events.go exec.go export.go help.go hijack.go history.go images.go import.go info.go inspect.go kill.go load.go login.go logout.go logs.go pause.go port.go ps.go pull.go push.go rename.go restart.go rm.go rmi.go run.go save.go search.go start.go stats.go stop.go tag.go top.go unpause.go utils.go version.go wait.go


var (
    ErrConnectionRefused = errors.New("Cannot connect to the Docker daemon. Is 'docker -d' running on this host?")

type ByStars Uses

type ByStars []registry.SearchResult

func (ByStars) Len Uses

func (r ByStars) Len() int

func (ByStars) Less Uses

func (r ByStars) Less(i, j int) bool

func (ByStars) Swap Uses

func (r ByStars) Swap(i, j int)

type DockerCli Uses

type DockerCli struct {
    // contains filtered or unexported fields

DockerCli represents the docker command line client. Instances of the client can be returned from NewDockerCli.

func NewDockerCli Uses

func NewDockerCli(in io.ReadCloser, out, err io.Writer, keyFile string, proto, addr string, tlsConfig *tls.Config) *DockerCli

NewDockerCli returns a DockerCli instance with IO output and error streams set by in, out and err. The key file, protocol (i.e. unix) and address are passed in as strings, along with the tls.Config. If the tls.Config is set the client scheme will be set to https. The client will be given a 32-second timeout (see

func (*DockerCli) CheckTtyInput Uses

func (cli *DockerCli) CheckTtyInput(attachStdin, ttyMode bool) error

func (*DockerCli) Cmd Uses

func (cli *DockerCli) Cmd(args ...string) error

Cmd executes the specified command.

func (*DockerCli) CmdAttach Uses

func (cli *DockerCli) CmdAttach(args ...string) error

CmdAttach attaches to a running container.

Usage: docker attach [OPTIONS] CONTAINER

func (*DockerCli) CmdBuild Uses

func (cli *DockerCli) CmdBuild(args ...string) error

CmdBuild builds a new image from the source code at a given path.

If '-' is provided instead of a path or URL, Docker will build an image from either a Dockerfile or tar archive read from STDIN.

Usage: docker build [OPTIONS] PATH | URL | -

func (*DockerCli) CmdCommit Uses

func (cli *DockerCli) CmdCommit(args ...string) error

CmdCommit creates a new image from a container's changes.


func (*DockerCli) CmdCp Uses

func (cli *DockerCli) CmdCp(args ...string) error

CmdCp copies files/folders from a path on the container to a directory on the host running the command.

If HOSTDIR is '-', the data is written as a tar file to STDOUT.


func (*DockerCli) CmdCreate Uses

func (cli *DockerCli) CmdCreate(args ...string) error

CmdCreate creates a new container from a given image.

Usage: docker create [OPTIONS] IMAGE [COMMAND] [ARG...]

func (*DockerCli) CmdDiff Uses

func (cli *DockerCli) CmdDiff(args ...string) error

CmdDiff shows changes on a container's filesystem.

Each changed file is printed on a separate line, prefixed with a single character that indicates the status of the file: C (modified), A (added), or D (deleted).

Usage: docker diff CONTAINER

func (*DockerCli) CmdEvents Uses

func (cli *DockerCli) CmdEvents(args ...string) error

CmdEvents prints a live stream of real time events from the server.

Usage: docker events [OPTIONS]

func (*DockerCli) CmdExec Uses

func (cli *DockerCli) CmdExec(args ...string) error

CmdExec runs a command in a running container.

Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...]

func (*DockerCli) CmdExport Uses

func (cli *DockerCli) CmdExport(args ...string) error

CmdExport exports a filesystem as a tar archive.

The tar archive is streamed to STDOUT by default or written to a file.

Usage: docker export [OPTIONS] CONTAINER

func (*DockerCli) CmdHelp Uses

func (cli *DockerCli) CmdHelp(args ...string) error

CmdHelp displays information on a Docker command.

If more than one command is specified, information is only shown for the first command.

Usage: docker help COMMAND or docker COMMAND --help

func (*DockerCli) CmdHistory Uses

func (cli *DockerCli) CmdHistory(args ...string) error

CmdHistory shows the history of an image.

Usage: docker history [OPTIONS] IMAGE

func (*DockerCli) CmdImages Uses

func (cli *DockerCli) CmdImages(args ...string) error

CmdImages lists the images in a specified repository, or all top-level images if no repository is specified.

Usage: docker images [OPTIONS] [REPOSITORY]

func (*DockerCli) CmdImport Uses

func (cli *DockerCli) CmdImport(args ...string) error

CmdImport creates an empty filesystem image, imports the contents of the tarball into the image, and optionally tags the image.

The URL argument is the address of a tarball (.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz) file. If the URL is '-', then the tar file is read from STDIN.

Usage: docker import [OPTIONS] URL [REPOSITORY[:TAG]]

func (*DockerCli) CmdInfo Uses

func (cli *DockerCli) CmdInfo(args ...string) error

CmdInfo displays system-wide information.

Usage: docker info

func (*DockerCli) CmdInspect Uses

func (cli *DockerCli) CmdInspect(args ...string) error

CmdInspect displays low-level information on one or more containers or images.


func (*DockerCli) CmdKill Uses

func (cli *DockerCli) CmdKill(args ...string) error

CmdKill kills one or more running container using SIGKILL or a specified signal.

Usage: docker kill [OPTIONS] CONTAINER [CONTAINER...]

func (*DockerCli) CmdLoad Uses

func (cli *DockerCli) CmdLoad(args ...string) error

CmdLoad loads an image from a tar archive.

The tar archive is read from STDIN by default, or from a tar archive file.

Usage: docker load [OPTIONS]

func (*DockerCli) CmdLogin Uses

func (cli *DockerCli) CmdLogin(args ...string) error

CmdLogin logs in or registers a user to a Docker registry service.

If no server is specified, the user will be logged into or registered to the registry's index server.

Usage: docker login SERVER

func (*DockerCli) CmdLogout Uses

func (cli *DockerCli) CmdLogout(args ...string) error

CmdLogout logs a user out from a Docker registry.

If no server is specified, the user will be logged out from the registry's index server.

Usage: docker logout [SERVER]

func (*DockerCli) CmdLogs Uses

func (cli *DockerCli) CmdLogs(args ...string) error

CmdLogs fetches the logs of a given container.


func (*DockerCli) CmdPause Uses

func (cli *DockerCli) CmdPause(args ...string) error

CmdPause pauses all processes within one or more containers.

Usage: docker pause CONTAINER [CONTAINER...]

func (*DockerCli) CmdPort Uses

func (cli *DockerCli) CmdPort(args ...string) error

CmdPort lists port mappings for a container. If a private port is specified, it also shows the public-facing port that is NATed to the private port.


func (*DockerCli) CmdPs Uses

func (cli *DockerCli) CmdPs(args ...string) error

CmdPs outputs a list of Docker containers.

Usage: docker ps [OPTIONS]

func (*DockerCli) CmdPull Uses

func (cli *DockerCli) CmdPull(args ...string) error

CmdPull pulls an image or a repository from the registry.

Usage: docker pull [OPTIONS] IMAGENAME[:TAG|@DIGEST]

func (*DockerCli) CmdPush Uses

func (cli *DockerCli) CmdPush(args ...string) error

CmdPush pushes an image or repository to the registry.

Usage: docker push NAME[:TAG]

func (*DockerCli) CmdRename Uses

func (cli *DockerCli) CmdRename(args ...string) error

CmdRename renames a container.

Usage: docker rename OLD_NAME NEW_NAME

func (*DockerCli) CmdRestart Uses

func (cli *DockerCli) CmdRestart(args ...string) error

CmdRestart restarts one or more running containers.

Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...]

func (*DockerCli) CmdRm Uses

func (cli *DockerCli) CmdRm(args ...string) error

func (*DockerCli) CmdRmi Uses

func (cli *DockerCli) CmdRmi(args ...string) error

CmdRmi removes all images with the specified name(s).

Usage: docker rmi [OPTIONS] IMAGE [IMAGE...]

func (*DockerCli) CmdRun Uses

func (cli *DockerCli) CmdRun(args ...string) error

CmdRun runs a command in a new container.

Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

func (*DockerCli) CmdSave Uses

func (cli *DockerCli) CmdSave(args ...string) error

CmdSave saves one or more images to a tar archive.

The tar archive is written to STDOUT by default, or written to a file.

Usage: docker save [OPTIONS] IMAGE [IMAGE...]

func (*DockerCli) CmdSearch Uses

func (cli *DockerCli) CmdSearch(args ...string) error

CmdSearch searches the Docker Hub for images.

Usage: docker search [OPTIONS] TERM

func (*DockerCli) CmdStart Uses

func (cli *DockerCli) CmdStart(args ...string) error

CmdStart starts one or more stopped containers.

Usage: docker start [OPTIONS] CONTAINER [CONTAINER...]

func (*DockerCli) CmdStats Uses

func (cli *DockerCli) CmdStats(args ...string) error

CmdStats displays a live stream of resource usage statistics for one or more containers.

This shows real-time information on CPU usage, memory usage, and network I/O.

Usage: docker stats CONTAINER [CONTAINER...]

func (*DockerCli) CmdStop Uses

func (cli *DockerCli) CmdStop(args ...string) error

CmdStop stops one or more running containers.

A running container is stopped by first sending SIGTERM and then SIGKILL if the container fails to stop within a grace period (the default is 10 seconds).

Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...]

func (*DockerCli) CmdTag Uses

func (cli *DockerCli) CmdTag(args ...string) error

CmdTag tags an image into a repository.


func (*DockerCli) CmdTop Uses

func (cli *DockerCli) CmdTop(args ...string) error

CmdTop displays the running processes of a container.

Usage: docker top CONTAINER

func (*DockerCli) CmdUnpause Uses

func (cli *DockerCli) CmdUnpause(args ...string) error

CmdUnpause unpauses all processes within a container, for one or more containers.

Usage: docker unpause CONTAINER [CONTAINER...]

func (*DockerCli) CmdVersion Uses

func (cli *DockerCli) CmdVersion(args ...string) error

CmdVersion shows Docker version information.

Available version information is shown for: client Docker version, client API version, client Go version, client Git commit, client OS/Arch, server Docker version, server API version, server Go version, server Git commit, and server OS/Arch.

Usage: docker version

func (*DockerCli) CmdWait Uses

func (cli *DockerCli) CmdWait(args ...string) error

CmdWait blocks until a container stops, then prints its exit code.

If more than one container is specified, this will wait synchronously on each container.

Usage: docker wait CONTAINER [CONTAINER...]

func (*DockerCli) HTTPClient Uses

func (cli *DockerCli) HTTPClient() *http.Client

func (*DockerCli) LoadConfigFile Uses

func (cli *DockerCli) LoadConfigFile() (err error)

func (*DockerCli) Subcmd Uses

func (cli *DockerCli) Subcmd(name, signature, description string, exitOnError bool) *flag.FlagSet

func (*DockerCli) WalkTree Uses

func (cli *DockerCli) WalkTree(noTrunc bool, images []*types.Image, byParent map[string][]*types.Image, prefix string, printNode func(cli *DockerCli, noTrunc bool, image *types.Image, prefix string))

FIXME: --viz and --tree are deprecated. Remove them in a future version.

type StatusError Uses

type StatusError struct {
    Status     string
    StatusCode int

An StatusError reports an unsuccessful exit by a command.

func (StatusError) Error Uses

func (e StatusError) Error() string

Package client imports 58 packages (graph). Updated 2018-04-15. Refresh now. Tools for package owners.