Documentation ¶
Overview ¶
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 https://docs.docker.com/installation/ for instructions on installing Docker.
Index ¶
- type ByStars
- type DockerCli
- func (cli *DockerCli) CheckTtyInput(attachStdin, ttyMode bool) error
- func (cli *DockerCli) CmdAttach(args ...string) error
- func (cli *DockerCli) CmdBuild(args ...string) error
- func (cli *DockerCli) CmdCommit(args ...string) error
- func (cli *DockerCli) CmdCp(args ...string) error
- func (cli *DockerCli) CmdCreate(args ...string) error
- func (cli *DockerCli) CmdDiff(args ...string) error
- func (cli *DockerCli) CmdEvents(args ...string) error
- func (cli *DockerCli) CmdExec(args ...string) error
- func (cli *DockerCli) CmdExport(args ...string) error
- func (cli *DockerCli) CmdHistory(args ...string) error
- func (cli *DockerCli) CmdImages(args ...string) error
- func (cli *DockerCli) CmdImport(args ...string) error
- func (cli *DockerCli) CmdInfo(args ...string) error
- func (cli *DockerCli) CmdInspect(args ...string) error
- func (cli *DockerCli) CmdKill(args ...string) error
- func (cli *DockerCli) CmdLoad(args ...string) error
- func (cli *DockerCli) CmdLogin(args ...string) error
- func (cli *DockerCli) CmdLogout(args ...string) error
- func (cli *DockerCli) CmdLogs(args ...string) error
- func (cli *DockerCli) CmdNetwork(args ...string) error
- func (cli *DockerCli) CmdNetworkConnect(args ...string) error
- func (cli *DockerCli) CmdNetworkCreate(args ...string) error
- func (cli *DockerCli) CmdNetworkDisconnect(args ...string) error
- func (cli *DockerCli) CmdNetworkInspect(args ...string) error
- func (cli *DockerCli) CmdNetworkLs(args ...string) error
- func (cli *DockerCli) CmdNetworkRm(args ...string) error
- func (cli *DockerCli) CmdPause(args ...string) error
- func (cli *DockerCli) CmdPort(args ...string) error
- func (cli *DockerCli) CmdPs(args ...string) error
- func (cli *DockerCli) CmdPull(args ...string) error
- func (cli *DockerCli) CmdPush(args ...string) error
- func (cli *DockerCli) CmdRename(args ...string) error
- func (cli *DockerCli) CmdRestart(args ...string) error
- func (cli *DockerCli) CmdRm(args ...string) error
- func (cli *DockerCli) CmdRmi(args ...string) error
- func (cli *DockerCli) CmdRun(args ...string) error
- func (cli *DockerCli) CmdSave(args ...string) error
- func (cli *DockerCli) CmdSearch(args ...string) error
- func (cli *DockerCli) CmdStart(args ...string) error
- func (cli *DockerCli) CmdStats(args ...string) error
- func (cli *DockerCli) CmdStop(args ...string) error
- func (cli *DockerCli) CmdTag(args ...string) error
- func (cli *DockerCli) CmdTop(args ...string) error
- func (cli *DockerCli) CmdUnpause(args ...string) error
- func (cli *DockerCli) CmdVersion(args ...string) (err error)
- func (cli *DockerCli) CmdVolume(args ...string) error
- func (cli *DockerCli) CmdVolumeCreate(args ...string) error
- func (cli *DockerCli) CmdVolumeInspect(args ...string) error
- func (cli *DockerCli) CmdVolumeLs(args ...string) error
- func (cli *DockerCli) CmdVolumeRm(args ...string) error
- func (cli *DockerCli) CmdWait(args ...string) error
- func (cli *DockerCli) HTTPClient() *http.Client
- func (cli *DockerCli) Initialize() error
- func (cli *DockerCli) PsFormat() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByStars ¶
type ByStars []registry.SearchResult
ByStars sorts search results in ascending order by number of stars.
type DockerCli ¶
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 ¶
func NewDockerCli(in io.ReadCloser, out, err io.Writer, clientFlags *cli.ClientFlags) *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 https://github.com/docker/docker/pull/8035).
func (*DockerCli) CheckTtyInput ¶
CheckTtyInput checks if we are trying to attach to a container tty from a non-tty client input stream, and if so, returns an error.
func (*DockerCli) CmdAttach ¶
CmdAttach attaches to a running container.
Usage: docker attach [OPTIONS] CONTAINER
func (*DockerCli) CmdBuild ¶
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 ¶
CmdCommit creates a new image from a container's changes.
Usage: docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
func (*DockerCli) CmdCp ¶
CmdCp copies files/folders to or from a path in a container.
When copying from a container, if DEST_PATH is '-' the data is written as a tar archive file to STDOUT.
When copying to a container, if SRC_PATH is '-' the data is read as a tar archive file from STDIN, and the destination CONTAINER:DEST_PATH, must specify a directory.
Usage:
docker cp CONTAINER:SRC_PATH DEST_PATH|- docker cp SRC_PATH|- CONTAINER:DEST_PATH
func (*DockerCli) CmdCreate ¶
CmdCreate creates a new container from a given image.
Usage: docker create [OPTIONS] IMAGE [COMMAND] [ARG...]
func (*DockerCli) CmdDiff ¶
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 ¶
CmdEvents prints a live stream of real time events from the server.
Usage: docker events [OPTIONS]
func (*DockerCli) CmdExec ¶
CmdExec runs a command in a running container.
Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
func (*DockerCli) CmdExport ¶
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) CmdHistory ¶
CmdHistory shows the history of an image.
Usage: docker history [OPTIONS] IMAGE
func (*DockerCli) CmdImages ¶
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 ¶
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 or a path to local file relative to docker client. If the URL is '-', then the tar file is read from STDIN.
Usage: docker import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]
func (*DockerCli) CmdInspect ¶
CmdInspect displays low-level information on one or more containers or images.
Usage: docker inspect [OPTIONS] CONTAINER|IMAGE [CONTAINER|IMAGE...]
func (*DockerCli) CmdKill ¶
CmdKill kills one or more running container using SIGKILL or a specified signal.
Usage: docker kill [OPTIONS] CONTAINER [CONTAINER...]
func (*DockerCli) CmdLoad ¶
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 ¶
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 ¶
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 ¶
CmdLogs fetches the logs of a given container.
docker logs [OPTIONS] CONTAINER
func (*DockerCli) CmdNetwork ¶
CmdNetwork is the parent subcommand for all network commands
Usage: docker network <COMMAND> [OPTIONS]
func (*DockerCli) CmdNetworkConnect ¶
CmdNetworkConnect connects a container to a network
Usage: docker network connect <NETWORK> <CONTAINER>
func (*DockerCli) CmdNetworkCreate ¶
CmdNetworkCreate creates a new network with a given name
Usage: docker network create [OPTIONS] <NETWORK-NAME>
func (*DockerCli) CmdNetworkDisconnect ¶
CmdNetworkDisconnect disconnects a container from a network
Usage: docker network disconnect <NETWORK> <CONTAINER>
func (*DockerCli) CmdNetworkInspect ¶
CmdNetworkInspect inspects the network object for more details
Usage: docker network inspect [OPTIONS] <NETWORK> [NETWORK...]
func (*DockerCli) CmdNetworkLs ¶
CmdNetworkLs lists all the netorks managed by docker daemon
Usage: docker network ls [OPTIONS]
func (*DockerCli) CmdNetworkRm ¶
CmdNetworkRm deletes a network
Usage: docker network rm <NETWORK-NAME | NETWORK-ID>
func (*DockerCli) CmdPause ¶
CmdPause pauses all processes within one or more containers.
Usage: docker pause CONTAINER [CONTAINER...]
func (*DockerCli) CmdPort ¶
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.
Usage: docker port CONTAINER [PRIVATE_PORT[/PROTO]]
func (*DockerCli) CmdPull ¶
CmdPull pulls an image or a repository from the registry.
Usage: docker pull [OPTIONS] IMAGENAME[:TAG|@DIGEST]
func (*DockerCli) CmdPush ¶
CmdPush pushes an image or repository to the registry.
Usage: docker push NAME[:TAG]
func (*DockerCli) CmdRestart ¶
CmdRestart restarts one or more containers.
Usage: docker restart [OPTIONS] CONTAINER [CONTAINER...]
func (*DockerCli) CmdRm ¶
CmdRm removes one or more containers.
Usage: docker rm [OPTIONS] CONTAINER [CONTAINER...]
func (*DockerCli) CmdRmi ¶
CmdRmi removes all images with the specified name(s).
Usage: docker rmi [OPTIONS] IMAGE [IMAGE...]
func (*DockerCli) CmdRun ¶
CmdRun runs a command in a new container.
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
func (*DockerCli) CmdSave ¶
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 ¶
CmdSearch searches the Docker Hub for images.
Usage: docker search [OPTIONS] TERM
func (*DockerCli) CmdStart ¶
CmdStart starts one or more containers.
Usage: docker start [OPTIONS] CONTAINER [CONTAINER...]
func (*DockerCli) CmdStats ¶
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 [OPTIONS] [CONTAINER...]
func (*DockerCli) CmdStop ¶
CmdStop stops one or more 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 ¶
CmdTag tags an image into a repository.
Usage: docker tag [OPTIONS] IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]
func (*DockerCli) CmdTop ¶
CmdTop displays the running processes of a container.
Usage: docker top CONTAINER
func (*DockerCli) CmdUnpause ¶
CmdUnpause unpauses all processes within a container, for one or more containers.
Usage: docker unpause CONTAINER [CONTAINER...]
func (*DockerCli) CmdVersion ¶
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) CmdVolume ¶
CmdVolume is the parent subcommand for all volume commands
Usage: docker volume <COMMAND> <OPTS>
func (*DockerCli) CmdVolumeCreate ¶
CmdVolumeCreate creates a new container from a given image.
Usage: docker volume create [OPTIONS]
func (*DockerCli) CmdVolumeInspect ¶
CmdVolumeInspect displays low-level information on one or more volumes.
Usage: docker volume inspect [OPTIONS] VOLUME [VOLUME...]
func (*DockerCli) CmdVolumeLs ¶
CmdVolumeLs outputs a list of Docker volumes.
Usage: docker volume ls [OPTIONS]
func (*DockerCli) CmdVolumeRm ¶
CmdVolumeRm removes one or more containers.
Usage: docker volume rm VOLUME [VOLUME...]
func (*DockerCli) CmdWait ¶
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 ¶
HTTPClient creates a new HTTP client with the cli's client transport instance.
func (*DockerCli) Initialize ¶
Initialize calls the init function that will setup the configuration for the client such as the TLS, tcp and other parameters used to run the client.
Source Files ¶
- attach.go
- build.go
- cli.go
- client.go
- commit.go
- cp.go
- create.go
- diff.go
- events.go
- exec.go
- export.go
- hijack.go
- history.go
- images.go
- import.go
- info.go
- inspect.go
- kill.go
- load.go
- login.go
- logout.go
- logs.go
- network.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
- trust.go
- unpause.go
- utils.go
- version.go
- volume.go
- wait.go