Update the cli.md docs with the output of the docker command

Docker-DCO-1.1-Signed-off-by: SvenDowideit <SvenDowideit@home.org.au> (github: SvenDowideit)
This commit is contained in:
SvenDowideit 2014-05-16 09:30:46 +10:00
parent 924aa984cf
commit d35330bb7a
1 changed files with 174 additions and 167 deletions

View File

@ -50,33 +50,36 @@ expect an integer, and they can only be specified once.
## daemon ## daemon
Usage of docker: Usage of docker:
--api-enable-cors=false Enable CORS headers in the remote API
-D, --debug=false: Enable debug mode -b, --bridge="" Attach containers to a pre-existing network bridge
-H, --host=[]: The socket(s) to bind to in daemon mode, specified using one or more tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd. use 'none' to disable container networking
-G, --group="docker": Group to assign the unix socket specified by -H when running in daemon mode; use '' (the empty string) to disable setting of a group --bip="" Use this CIDR notation address for the network bridge's IP, not compatible with -b
--api-enable-cors=false: Enable CORS headers in the remote API -d, --daemon=false Enable daemon mode
-b, --bridge="": Attach containers to a pre-existing network bridge; use 'none' to disable container networking -D, --debug=false Enable debug mode
-bip="": Use this CIDR notation address for the network bridge᾿s IP, not compatible with -b --dns=[] Force docker to use specific DNS servers
-d, --daemon=false: Enable daemon mode --dns-search=[] Force Docker to use specific DNS search domains
--dns=[]: Force docker to use specific DNS servers -e, --exec-driver="native" Force the docker runtime to use a specific exec driver
--dns-search=[]: Force Docker to use specific DNS search domains -G, --group="docker" Group to assign the unix socket specified by -H when running in daemon mode
--enable-selinux=false: Enable selinux support for running containers use '' (the empty string) to disable setting of a group
-g, --graph="/var/lib/docker": Path to use as the root of the docker runtime -g, --graph="/var/lib/docker" Path to use as the root of the docker runtime
--icc=true: Enable inter-container communication -H, --host=[] The socket(s) to bind to in daemon mode
--ip="0.0.0.0": Default IP address to use when binding container ports specified using one or more tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd.
--ip-forward=true: Enable net.ipv4.ip_forward --icc=true Enable inter-container communication
--iptables=true: Enable Docker᾿s addition of iptables rules --ip="0.0.0.0" Default IP address to use when binding container ports
-p, --pidfile="/var/run/docker.pid": Path to use for daemon PID file --ip-forward=true Enable net.ipv4.ip_forward
-r, --restart=true: Restart previously running containers --iptables=true Enable Docker's addition of iptables rules
-s, --storage-driver="": Force the docker runtime to use a specific storage driver --mtu=0 Set the containers network MTU
-e, --exec-driver="native": Force the docker runtime to use a specific exec driver if no value is provided: default to the default route MTU or 1500 if no default route is available
-v, --version=false: Print version information and quit -p, --pidfile="/var/run/docker.pid" Path to use for daemon PID file
--tls=false: Use TLS; implied by tls-verify flags -r, --restart=true Restart previously running containers
--tlscacert="~/.docker/ca.pem": Trust only remotes providing a certificate signed by the CA given here -s, --storage-driver="" Force the docker runtime to use a specific storage driver
--tlscert="~/.docker/cert.pem": Path to TLS certificate file --selinux-enabled=false Enable selinux support
--tlskey="~/.docker/key.pem": Path to TLS key file --tls=false Use TLS; implied by tls-verify flags
--tlsverify=false: Use TLS and verify the remote (daemon: verify client, client: verify daemon) --tlscacert="/home/sven/.docker/ca.pem" Trust only remotes providing a certificate signed by the CA given here
--mtu=0: Set the containers network MTU; if no value is provided: default to the default route MTU or 1500 if no default route is available --tlscert="/home/sven/.docker/cert.pem" Path to TLS certificate file
--tlskey="/home/sven/.docker/key.pem" Path to TLS key file
--tlsverify=false Use TLS and verify the remote (daemon: verify client, client: verify daemon)
-v, --version=false Print version information and quit
Options with [] may be specified multiple times. Options with [] may be specified multiple times.
@ -126,12 +129,12 @@ like this:
## attach ## attach
Attach to a running container. Usage: docker attach [OPTIONS] CONTAINER
Usage: docker attach CONTAINER Attach to a running container
--no-stdin=false: Do not attach stdin --no-stdin=false Do not attach stdin
--sig-proxy=true: Proxify all received signal to the process (even in non-tty mode) --sig-proxy=true Proxify all received signal to the process (even in non-tty mode)
The `attach` command will allow you to view or The `attach` command will allow you to view or
interact with any running container, detached (`-d`) interact with any running container, detached (`-d`)
@ -185,15 +188,14 @@ To kill the container, use `docker kill`.
## build ## build
Build a new container image from the source code at PATH
Usage: docker build [OPTIONS] PATH | URL | - Usage: docker build [OPTIONS] PATH | URL | -
-t, --tag="": Repository name (and optionally a tag) to be applied Build a new container image from the source code at PATH
to the resulting image in case of success.
-q, --quiet=false: Suppress the verbose output generated by the containers. --no-cache=false Do not use cache when building the image
--no-cache: Do not use the cache when building the image. -q, --quiet=false Suppress the verbose output generated by the containers
--rm=true: Remove intermediate containers after a successful build --rm=true Remove intermediate containers after a successful build
-t, --tag="" Repository name (and optionally a tag) to be applied to the resulting image in case of success
Use this command to build Docker images from a Dockerfile Use this command to build Docker images from a Dockerfile
and a "context". and a "context".
@ -293,12 +295,12 @@ schema.
## commit ## commit
Create a new image from a container᾿s changes
Usage: docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]] Usage: docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
-m, --message="": Commit message Create a new image from a container's changes
-a, --author="": Author (eg. "John Hannibal Smith <hannibal@a-team.com>"
-a, --author="" Author (eg. "John Hannibal Smith <hannibal@a-team.com>"
-m, --message="" Commit message
It can be useful to commit a container's file changes or settings into a It can be useful to commit a container's file changes or settings into a
new image. This allows you debug a container by running an interactive new image. This allows you debug a container by running an interactive
@ -325,8 +327,7 @@ path. Paths are relative to the root of the filesystem.
Usage: docker cp CONTAINER:PATH HOSTPATH Usage: docker cp CONTAINER:PATH HOSTPATH
$ sudo docker cp 7bb0e258aefe:/etc/debian_version . Copy files/folders from the PATH to the HOSTPATH
$ sudo docker cp blue_frog:/etc/hosts .
## diff ## diff
@ -334,6 +335,8 @@ List the changed files and directories in a container᾿s filesystem
Usage: docker diff CONTAINER Usage: docker diff CONTAINER
Inspect changes on a container's filesystem
There are 3 events that are listed in the `diff`: There are 3 events that are listed in the `diff`:
1. `A` - Add 1. `A` - Add
@ -358,14 +361,12 @@ For example:
## events ## events
Usage: docker events [OPTIONS]
Get real time events from the server Get real time events from the server
Usage: docker events --since="" Show all events created since timestamp
--until="" Stream events until this timestamp
--since="": Show all events created since timestamp
(either seconds since epoch, or date string as below)
--until="": Show events created before timestamp
(either seconds since epoch, or date string as below)
### Examples ### Examples
@ -403,22 +404,22 @@ You'll need two shells for this example.
## export ## export
Export the contents of a filesystem as a tar archive to STDOUT
Usage: docker export CONTAINER Usage: docker export CONTAINER
Export the contents of a filesystem as a tar archive to STDOUT
For example: For example:
$ sudo docker export red_panda > latest.tar $ sudo docker export red_panda > latest.tar
## history ## history
Show the history of an image
Usage: docker history [OPTIONS] IMAGE Usage: docker history [OPTIONS] IMAGE
--no-trunc=false: Don᾿t truncate output Show the history of an image
-q, --quiet=false: Only show numeric IDs
--no-trunc=false Don't truncate output
-q, --quiet=false Only show numeric IDs
To see how the `docker:latest` image was built: To see how the `docker:latest` image was built:
@ -433,13 +434,13 @@ To see how the `docker:latest` image was built:
## images ## images
List images
Usage: docker images [OPTIONS] [NAME] Usage: docker images [OPTIONS] [NAME]
-a, --all=false: Show all images (by default filter out the intermediate image layers) List images
--no-trunc=false: Don᾿t truncate output
-q, --quiet=false: Only show numeric IDs -a, --all=false Show all images (by default filter out the intermediate image layers)
--no-trunc=false Don't truncate output
-q, --quiet=false Only show numeric IDs
The default `docker images` will show all top level The default `docker images` will show all top level
images, their repository and tags, and their virtual size. images, their repository and tags, and their virtual size.
@ -481,8 +482,7 @@ by default.
Usage: docker import URL|- [REPOSITORY[:TAG]] Usage: docker import URL|- [REPOSITORY[:TAG]]
Create an empty filesystem image and import the contents of the tarball Create an empty filesystem image and import the contents of the tarball (.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz) into it, then optionally tag it.
(.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz) into it, then optionally tag it.
URLs must start with `http` and point to a single URLs must start with `http` and point to a single
file archive (.tar, .tar.gz, .tgz, .bzip, .tar.xz, or .txz) containing a file archive (.tar, .tar.gz, .tgz, .bzip, .tar.xz, or .txz) containing a
@ -515,10 +515,12 @@ tar, then the ownerships might not get preserved.
## info ## info
Display system-wide information.
Usage: docker info Usage: docker info
Display system-wide information
For example:
$ sudo docker info $ sudo docker info
Containers: 292 Containers: 292
Images: 194 Images: 194
@ -536,11 +538,11 @@ ensure we know how your setup is configured.
## inspect ## inspect
Return low-level information on a container/image
Usage: docker inspect CONTAINER|IMAGE [CONTAINER|IMAGE...] Usage: docker inspect CONTAINER|IMAGE [CONTAINER|IMAGE...]
-f, --format="": Format the output using the given go template. Return low-level information on a container/image
-f, --format="" Format the output using the given go template.
By default, this will render all results in a JSON array. If a format is By default, this will render all results in a JSON array. If a format is
specified, the given template will be executed for each result. specified, the given template will be executed for each result.
@ -590,11 +592,11 @@ contains complex json object, so to grab it as JSON, you use
## kill ## kill
Kill a running container (send SIGKILL, or specified signal)
Usage: docker kill [OPTIONS] CONTAINER [CONTAINER...] Usage: docker kill [OPTIONS] CONTAINER [CONTAINER...]
-s, --signal="KILL": Signal to send to the container Kill a running container (send SIGKILL, or specified signal)
-s, --signal="KILL" Signal to send to the container
The main process inside the container will be sent SIGKILL, or any The main process inside the container will be sent SIGKILL, or any
signal specified with option `--signal`. signal specified with option `--signal`.
@ -610,11 +612,11 @@ signal specified with option `--signal`.
## load ## load
Load an image from a tar archive on STDIN
Usage: docker load Usage: docker load
-i, --input="": Read from a tar archive file, instead of STDIN Load an image from a tar archive on STDIN
-i, --input="" Read from a tar archive file, instead of STDIN
Loads a tarred repository from a file or the standard input stream. Loads a tarred repository from a file or the standard input stream.
Restores both images and tags. Restores both images and tags.
@ -636,13 +638,13 @@ Restores both images and tags.
## login ## login
Register or Login to the docker registry server
Usage: docker login [OPTIONS] [SERVER] Usage: docker login [OPTIONS] [SERVER]
-e, --email="": Email Register or Login to a docker registry server, if no server is specified "https://index.docker.io/v1/" is the default.
-p, --password="": Password
-u, --username="": Username -e, --email="" Email
-p, --password="" Password
-u, --username="" Username
If you want to login to a private registry you can If you want to login to a private registry you can
specify this by adding the server name. specify this by adding the server name.
@ -652,12 +654,12 @@ specify this by adding the server name.
## logs ## logs
Usage: docker logs CONTAINER
Fetch the logs of a container Fetch the logs of a container
Usage: docker logs [OPTIONS] CONTAINER -f, --follow=false Follow log output
-t, --timestamps=false Show timestamps
-f, --follow=false: Follow log output
-t, --timestamps=false: Show timestamps
The `docker logs` command batch-retrieves all logs The `docker logs` command batch-retrieves all logs
present at the time of execution. present at the time of execution.
@ -668,24 +670,24 @@ and stderr.
## port ## port
Usage: docker port [OPTIONS] CONTAINER PRIVATE_PORT Usage: docker port CONTAINER PRIVATE_PORT
Lookup the public-facing port which is NAT-ed to PRIVATE_PORT Lookup the public-facing port which is NAT-ed to PRIVATE_PORT
## ps ## ps
List containers
Usage: docker ps [OPTIONS] Usage: docker ps [OPTIONS]
-a, --all=false: Show all containers. Only running containers are shown by default. List containers
--before="": Show only container created before Id or Name, include non-running ones.
-l, --latest=false: Show only the latest created container, include non-running ones. -a, --all=false Show all containers. Only running containers are shown by default.
-n=-1: Show n last created containers, include non-running ones. --before="" Show only container created before Id or Name, include non-running ones.
--no-trunc=false: Don᾿t truncate output -l, --latest=false Show only the latest created container, include non-running ones.
-q, --quiet=false: Only display numeric IDs -n=-1 Show n last created containers, include non-running ones.
-s, --size=false: Display sizes, not to be used with -q --no-trunc=false Don't truncate output
--since="": Show only containers created since Id or Name, include non-running ones. -q, --quiet=false Only display numeric IDs
-s, --size=false Display sizes
--since="" Show only containers created since Id or Name, include non-running ones.
Running `docker ps` showing 2 linked containers. Running `docker ps` showing 2 linked containers.
@ -699,10 +701,10 @@ Running `docker ps` showing 2 linked containers.
## pull ## pull
Pull an image or a repository from the registry
Usage: docker pull NAME[:TAG] Usage: docker pull NAME[:TAG]
Pull an image or a repository from the registry
Most of your images will be created on top of a base image from the Most of your images will be created on top of a base image from the
[Docker.io](https://index.docker.io) registry. [Docker.io](https://index.docker.io) registry.
@ -721,30 +723,30 @@ use `docker pull`:
## push ## push
Push an image or a repository to the registry
Usage: docker push NAME[:TAG] Usage: docker push NAME[:TAG]
Push an image or a repository to the registry
Use `docker push` to share your images on public or Use `docker push` to share your images on public or
private registries. private registries.
## restart ## restart
Usage: docker restart [OPTIONS] CONTAINER [CONTAINER...]
Restart a running container Restart a running container
Usage: docker restart [OPTIONS] NAME -t, --time=10 Number of seconds to try to stop for before killing the container. Once killed it will then be restarted. Default=10
-t, --time=10: Number of seconds to try to stop for before killing the container. Once killed it will then be restarted. Default=10
## rm ## rm
Usage: docker rm [OPTIONS] CONTAINER [CONTAINER...]
Remove one or more containers Remove one or more containers
Usage: docker rm [OPTIONS] CONTAINER -f, --force=false Force removal of running container
-l, --link=false Remove the specified link and not the underlying container
-l, --link="": Remove the link instead of the actual container -v, --volumes=false Remove the volumes associated to the container
-f, --force=false: Force removal of running container
-v, --volumes=false: Remove the volumes associated to the container
### Known Issues (rm) ### Known Issues (rm)
@ -776,12 +778,12 @@ delete them. Any running containers will not be deleted.
## rmi ## rmi
Remove one or more images
Usage: docker rmi IMAGE [IMAGE...] Usage: docker rmi IMAGE [IMAGE...]
-f, --force=false: Force Remove one or more images
--no-prune=false: Do not delete untagged parents
-f, --force=false Force
--no-prune=false Do not delete untagged parents
### Removing tagged images ### Removing tagged images
@ -813,13 +815,12 @@ removed before the image is removed.
## run ## run
Run a command in a new container Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Usage: docker run [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...] Run a command in a new container
-a, --attach=[] Attach to stdin, stdout or stderr. -a, --attach=[] Attach to stdin, stdout or stderr.
-c, --cpu-shares=0 CPU shares (relative weight) -c, --cpu-shares=0 CPU shares (relative weight)
--cpuset="" CPUs in which to allow execution (0-3, 0,1)
--cidfile="" Write the container ID to the file --cidfile="" Write the container ID to the file
-d, --detach=false Detached mode: Run container in the background, print new container id -d, --detach=false Detached mode: Run container in the background, print new container id
--dns=[] Set custom dns servers --dns=[] Set custom dns servers
@ -1061,11 +1062,11 @@ application change:
## save ## save
Save an image to a tar archive (streamed to stdout by default)
Usage: docker save IMAGE Usage: docker save IMAGE
-o, --output="": Write to an file, instead of STDOUT Save an image to a tar archive (streamed to stdout by default)
-o, --output="" Write to an file, instead of STDOUT
Produces a tarred repository to the standard output stream. Contains all Produces a tarred repository to the standard output stream. Contains all
parent layers, and all tags + versions, or specified repo:tag. parent layers, and all tags + versions, or specified repo:tag.
@ -1088,9 +1089,11 @@ Search [Docker.io](https://index.docker.io) for images
Usage: docker search TERM Usage: docker search TERM
--no-trunc=false: Don᾿t truncate output Search the docker index for images
-s, --stars=0: Only displays with at least xxx stars
-t, --trusted=false: Only show trusted builds --no-trunc=false Don't truncate output
-s, --stars=0 Only displays with at least xxx stars
-t, --trusted=false Only show trusted builds
See [*Find Public Images on Docker.io*]( See [*Find Public Images on Docker.io*](
/use/workingwithrepository/#find-public-images-on-dockerio) for /use/workingwithrepository/#find-public-images-on-dockerio) for
@ -1098,31 +1101,31 @@ more details on finding shared images from the commandline.
## start ## start
Start a stopped container Usage: docker start CONTAINER [CONTAINER...]
Usage: docker start [OPTIONS] CONTAINER Restart a stopped container
-a, --attach=false: Attach container᾿s stdout/stderr and forward all signals to the process -a, --attach=false Attach container's stdout/stderr and forward all signals to the process
-i, --interactive=false: Attach container᾿s stdin -i, --interactive=false Attach container's stdin
## stop ## stop
Stop a running container (Send SIGTERM, and then SIGKILL after grace period)
Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...] Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...]
-t, --time=10: Number of seconds to wait for the container to stop before killing it. Stop a running container (Send SIGTERM, and then SIGKILL after grace period)
-t, --time=10 Number of seconds to wait for the container to stop before killing it.
The main process inside the container will receive SIGTERM, and after a The main process inside the container will receive SIGTERM, and after a
grace period, SIGKILL grace period, SIGKILL
## tag ## tag
Tag an image into a repository
Usage: docker tag [OPTIONS] IMAGE [REGISTRYHOST/][USERNAME/]NAME[:TAG] Usage: docker tag [OPTIONS] IMAGE [REGISTRYHOST/][USERNAME/]NAME[:TAG]
-f, --force=false: Force Tag an image into a repository
-f, --force=false Force
You can group your images together using names and tags, and then upload You can group your images together using names and tags, and then upload
them to [*Share Images via Repositories*]( them to [*Share Images via Repositories*](
@ -1136,11 +1139,15 @@ Lookup the running processes of a container
## version ## version
Usage: docker version
Show the docker version information.
Show the version of the Docker client, daemon, and latest released Show the version of the Docker client, daemon, and latest released
version. version.
## wait ## wait
Usage: docker wait [OPTIONS] NAME Usage: docker wait CONTAINER [CONTAINER...]
Block until a container stops, then print its exit code. Block until a container stops, then print its exit code.