mirror of https://github.com/docker/docs.git
engine: update reference docs with "console" code hints
Also updates in the descriptions for `--stop-signal` and `--stop-timeout`. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
20f2ef5869
commit
304f64ccec
|
|
@ -93,7 +93,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### Attach to and detach from a running container
|
### Attach to and detach from a running container
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d --name topdemo ubuntu /usr/bin/top -b
|
$ docker run -d --name topdemo ubuntu /usr/bin/top -b
|
||||||
|
|
||||||
$ docker attach topdemo
|
$ docker attach topdemo
|
||||||
|
|
@ -139,24 +139,21 @@ examples: |-
|
||||||
And in this second example, you can see the exit code returned by the `bash`
|
And in this second example, you can see the exit code returned by the `bash`
|
||||||
process is returned by the `docker attach` command to its caller too:
|
process is returned by the `docker attach` command to its caller too:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run --name test -d -it debian
|
$ docker run --name test -d -it debian
|
||||||
|
275c44472aebd77c926d4527885bb09f2f6db21d878c75f0a1c212c03d3bcfab
|
||||||
|
|
||||||
275c44472aebd77c926d4527885bb09f2f6db21d878c75f0a1c212c03d3bcfab
|
$ docker attach test
|
||||||
|
root@f38c87f2a42d:/# exit 13
|
||||||
|
|
||||||
$ docker attach test
|
exit
|
||||||
|
|
||||||
root@f38c87f2a42d:/# exit 13
|
$ echo $?
|
||||||
|
13
|
||||||
|
|
||||||
exit
|
$ docker ps -a | grep test
|
||||||
|
|
||||||
$ echo $?
|
275c44472aeb debian:7 "/bin/bash" 26 seconds ago Exited (13) 17 seconds ago test
|
||||||
|
|
||||||
13
|
|
||||||
|
|
||||||
$ docker ps -a | grep test
|
|
||||||
|
|
||||||
275c44472aeb debian:7 "/bin/bash" 26 seconds ago Exited (13) 17 seconds ago test
|
|
||||||
```
|
```
|
||||||
deprecated: false
|
deprecated: false
|
||||||
experimental: false
|
experimental: false
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ long: |-
|
||||||
For example, run this command to use a directory called `docker` in the branch
|
For example, run this command to use a directory called `docker` in the branch
|
||||||
`container`:
|
`container`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build https://github.com/docker/rootfs.git#container:docker
|
$ docker build https://github.com/docker/rootfs.git#container:docker
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ long: |-
|
||||||
|
|
||||||
If you pass an URL to a remote tarball, the URL itself is sent to the daemon:
|
If you pass an URL to a remote tarball, the URL itself is sent to the daemon:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build http://server/context.tar.gz
|
$ docker build http://server/context.tar.gz
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -78,7 +78,7 @@ long: |-
|
||||||
Instead of specifying a context, you can pass a single `Dockerfile` in the
|
Instead of specifying a context, you can pass a single `Dockerfile` in the
|
||||||
`URL` or pipe the file in via `STDIN`. To pipe a `Dockerfile` from `STDIN`:
|
`URL` or pipe the file in via `STDIN`. To pipe a `Dockerfile` from `STDIN`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build - < Dockerfile
|
$ docker build - < Dockerfile
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -436,7 +436,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### Build with PATH
|
### Build with PATH
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build .
|
$ docker build .
|
||||||
|
|
||||||
Uploading context 10240 bytes
|
Uploading context 10240 bytes
|
||||||
|
|
@ -481,7 +481,7 @@ examples: |-
|
||||||
|
|
||||||
### Build with URL
|
### Build with URL
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build github.com/creack/docker-firefox
|
$ docker build github.com/creack/docker-firefox
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -489,7 +489,7 @@ examples: |-
|
||||||
The Dockerfile at the root of the repository is used as Dockerfile. You can
|
The Dockerfile at the root of the repository is used as Dockerfile. You can
|
||||||
specify an arbitrary Git repository by using the `git://` or `git@` scheme.
|
specify an arbitrary Git repository by using the `git://` or `git@` scheme.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build -f ctx/Dockerfile http://server/ctx.tar.gz
|
$ docker build -f ctx/Dockerfile http://server/ctx.tar.gz
|
||||||
|
|
||||||
Downloading context: http://server/ctx.tar.gz [===================>] 240 B/240 B
|
Downloading context: http://server/ctx.tar.gz [===================>] 240 B/240 B
|
||||||
|
|
@ -515,7 +515,7 @@ examples: |-
|
||||||
|
|
||||||
### Build with -
|
### Build with -
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build - < Dockerfile
|
$ docker build - < Dockerfile
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -524,7 +524,7 @@ examples: |-
|
||||||
Since there is no context, a Dockerfile `ADD` only works if it refers to a
|
Since there is no context, a Dockerfile `ADD` only works if it refers to a
|
||||||
remote URL.
|
remote URL.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build - < context.tar.gz
|
$ docker build - < context.tar.gz
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -533,7 +533,7 @@ examples: |-
|
||||||
|
|
||||||
### Use a .dockerignore file
|
### Use a .dockerignore file
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build .
|
$ docker build .
|
||||||
|
|
||||||
Uploading context 18.829 MB
|
Uploading context 18.829 MB
|
||||||
|
|
@ -572,7 +572,7 @@ examples: |-
|
||||||
|
|
||||||
### Tag an image (-t)
|
### Tag an image (-t)
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build -t vieux/apache:2.0 .
|
$ docker build -t vieux/apache:2.0 .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -586,27 +586,27 @@ examples: |-
|
||||||
For example, to tag an image both as `whenry/fedora-jboss:latest` and
|
For example, to tag an image both as `whenry/fedora-jboss:latest` and
|
||||||
`whenry/fedora-jboss:v2.1`, use the following:
|
`whenry/fedora-jboss:v2.1`, use the following:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build -t whenry/fedora-jboss:latest -t whenry/fedora-jboss:v2.1 .
|
$ docker build -t whenry/fedora-jboss:latest -t whenry/fedora-jboss:v2.1 .
|
||||||
```
|
```
|
||||||
|
|
||||||
### Specify a Dockerfile (-f)
|
### Specify a Dockerfile (-f)
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build -f Dockerfile.debug .
|
$ docker build -f Dockerfile.debug .
|
||||||
```
|
```
|
||||||
|
|
||||||
This will use a file called `Dockerfile.debug` for the build instructions
|
This will use a file called `Dockerfile.debug` for the build instructions
|
||||||
instead of `Dockerfile`.
|
instead of `Dockerfile`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ curl example.com/remote/Dockerfile | docker build -f - .
|
$ curl example.com/remote/Dockerfile | docker build -f - .
|
||||||
```
|
```
|
||||||
|
|
||||||
The above command will use the current directory as the build context and read
|
The above command will use the current directory as the build context and read
|
||||||
a Dockerfile from stdin.
|
a Dockerfile from stdin.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build -f dockerfiles/Dockerfile.debug -t myapp_debug .
|
$ docker build -f dockerfiles/Dockerfile.debug -t myapp_debug .
|
||||||
$ docker build -f dockerfiles/Dockerfile.prod -t myapp_prod .
|
$ docker build -f dockerfiles/Dockerfile.prod -t myapp_prod .
|
||||||
```
|
```
|
||||||
|
|
@ -615,7 +615,7 @@ examples: |-
|
||||||
`.`) twice, once using a debug version of a `Dockerfile` and once using a
|
`.`) twice, once using a debug version of a `Dockerfile` and once using a
|
||||||
production version.
|
production version.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ cd /home/me/myapp/some/dir/really/deep
|
$ cd /home/me/myapp/some/dir/really/deep
|
||||||
$ docker build -f /home/me/myapp/dockerfiles/debug /home/me/myapp
|
$ docker build -f /home/me/myapp/dockerfiles/debug /home/me/myapp
|
||||||
$ docker build -f ../../../../dockerfiles/debug /home/me/myapp
|
$ docker build -f ../../../../dockerfiles/debug /home/me/myapp
|
||||||
|
|
@ -658,7 +658,7 @@ examples: |-
|
||||||
files. The `ARG` instruction lets Dockerfile authors define values that users
|
files. The `ARG` instruction lets Dockerfile authors define values that users
|
||||||
can set at build-time using the `--build-arg` flag:
|
can set at build-time using the `--build-arg` flag:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build --build-arg HTTP_PROXY=http://10.20.30.2:1234 --build-arg FTP_PROXY=http://40.50.60.5:4567 .
|
$ docker build --build-arg HTTP_PROXY=http://10.20.30.2:1234 --build-arg FTP_PROXY=http://40.50.60.5:4567 .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -677,7 +677,7 @@ examples: |-
|
||||||
from the local environment will be propagated into the Docker container being
|
from the local environment will be propagated into the Docker container being
|
||||||
built:
|
built:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ export HTTP_PROXY=http://10.20.30.2:1234
|
$ export HTTP_PROXY=http://10.20.30.2:1234
|
||||||
$ docker build --build-arg HTTP_PROXY .
|
$ docker build --build-arg HTTP_PROXY .
|
||||||
```
|
```
|
||||||
|
|
@ -729,7 +729,7 @@ examples: |-
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build -t mybuildimage --target build-env .
|
$ docker build -t mybuildimage --target build-env .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -754,7 +754,7 @@ examples: |-
|
||||||
context, and exports the files to a directory named `out` in the current directory.
|
context, and exports the files to a directory named `out` in the current directory.
|
||||||
If the directory does not exist, Docker creates the directory automatically:
|
If the directory does not exist, Docker creates the directory automatically:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build -o out .
|
$ docker build -o out .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -763,13 +763,13 @@ examples: |-
|
||||||
using the long-hand CSV syntax, specifying both `type` and `dest` (destination
|
using the long-hand CSV syntax, specifying both `type` and `dest` (destination
|
||||||
path):
|
path):
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build --output type=local,dest=out .
|
$ docker build --output type=local,dest=out .
|
||||||
```
|
```
|
||||||
|
|
||||||
Use the `tar` type to export the files as a `.tar` archive:
|
Use the `tar` type to export the files as a `.tar` archive:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build --output type=tar,dest=out.tar .
|
$ docker build --output type=tar,dest=out.tar .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -778,8 +778,8 @@ examples: |-
|
||||||
and writes the output tarball to standard output, which is then redirected to
|
and writes the output tarball to standard output, which is then redirected to
|
||||||
the `out.tar` file:
|
the `out.tar` file:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
docker build -o - . > out.tar
|
$ docker build -o - . > out.tar
|
||||||
```
|
```
|
||||||
|
|
||||||
The `--output` option exports all files from the target stage. A common pattern
|
The `--output` option exports all files from the target stage. A common pattern
|
||||||
|
|
@ -800,7 +800,7 @@ examples: |-
|
||||||
When building the Dockerfile with the `-o` option, only the files from the final
|
When building the Dockerfile with the `-o` option, only the files from the final
|
||||||
stage are exported to the `out` directory, in this case, the `vndr` binary:
|
stage are exported to the `out` directory, in this case, the `vndr` binary:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build -o out .
|
$ docker build -o out .
|
||||||
|
|
||||||
[+] Building 2.3s (7/7) FINISHED
|
[+] Building 2.3s (7/7) FINISHED
|
||||||
|
|
@ -848,7 +848,7 @@ examples: |-
|
||||||
The following example builds an image with inline-cache metadata and pushes it
|
The following example builds an image with inline-cache metadata and pushes it
|
||||||
to a registry, then uses the image as a cache source on another machine:
|
to a registry, then uses the image as a cache source on another machine:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build -t myname/myapp --build-arg BUILDKIT_INLINE_CACHE=1 .
|
$ docker build -t myname/myapp --build-arg BUILDKIT_INLINE_CACHE=1 .
|
||||||
$ docker push myname/myapp
|
$ docker push myname/myapp
|
||||||
```
|
```
|
||||||
|
|
@ -856,8 +856,9 @@ examples: |-
|
||||||
After pushing the image, the image is used as cache source on another machine.
|
After pushing the image, the image is used as cache source on another machine.
|
||||||
BuildKit automatically pulls the image from the registry if needed.
|
BuildKit automatically pulls the image from the registry if needed.
|
||||||
|
|
||||||
```bash
|
On another machine:
|
||||||
# on another machine
|
|
||||||
|
```console
|
||||||
$ docker build --cache-from myname/myapp .
|
$ docker build --cache-from myname/myapp .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -963,7 +964,7 @@ examples: |-
|
||||||
|
|
||||||
Then make sure the experimental flag is enabled:
|
Then make sure the experimental flag is enabled:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker version -f '{{.Server.Experimental}}'
|
$ docker version -f '{{.Server.Experimental}}'
|
||||||
true
|
true
|
||||||
```
|
```
|
||||||
|
|
@ -983,15 +984,15 @@ examples: |-
|
||||||
|
|
||||||
An image named `test` is built with `--squash` argument.
|
An image named `test` is built with `--squash` argument.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker build --squash -t test .
|
$ docker build --squash -t test .
|
||||||
|
|
||||||
[...]
|
<...>
|
||||||
```
|
```
|
||||||
|
|
||||||
If everything is right, the history looks like this:
|
If everything is right, the history looks like this:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker history test
|
$ docker history test
|
||||||
|
|
||||||
IMAGE CREATED CREATED BY SIZE COMMENT
|
IMAGE CREATED CREATED BY SIZE COMMENT
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### Commit a container
|
### Commit a container
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps
|
$ docker ps
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -81,7 +81,7 @@ examples: |-
|
||||||
|
|
||||||
### Commit a container with new configurations
|
### Commit a container with new configurations
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps
|
$ docker ps
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -103,7 +103,7 @@ examples: |-
|
||||||
|
|
||||||
### Commit a container with new `CMD` and `EXPOSE` instructions
|
### Commit a container with new `CMD` and `EXPOSE` instructions
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps
|
$ docker ps
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### Create a config
|
### Create a config
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ printf <config> | docker config create my_config -
|
$ printf <config> | docker config create my_config -
|
||||||
|
|
||||||
onakdyv307se2tl7nl20anokv
|
onakdyv307se2tl7nl20anokv
|
||||||
|
|
@ -49,7 +49,7 @@ examples: |-
|
||||||
|
|
||||||
### Create a config with a file
|
### Create a config with a file
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker config create my_config ./config.json
|
$ docker config create my_config ./config.json
|
||||||
|
|
||||||
dg426haahpi5ezmkkj5kyl3sn
|
dg426haahpi5ezmkkj5kyl3sn
|
||||||
|
|
@ -62,7 +62,7 @@ examples: |-
|
||||||
|
|
||||||
### Create a config with labels
|
### Create a config with labels
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker config create \
|
$ docker config create \
|
||||||
--label env=dev \
|
--label env=dev \
|
||||||
--label rev=20170324 \
|
--label rev=20170324 \
|
||||||
|
|
@ -71,7 +71,7 @@ examples: |-
|
||||||
eo7jnzguqgtpdah3cm5srfb97
|
eo7jnzguqgtpdah3cm5srfb97
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker config inspect my_config
|
$ docker config inspect my_config
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -46,14 +46,14 @@ examples: |-
|
||||||
|
|
||||||
For example, given the following config:
|
For example, given the following config:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker config ls
|
$ docker config ls
|
||||||
|
|
||||||
ID NAME CREATED UPDATED
|
ID NAME CREATED UPDATED
|
||||||
eo7jnzguqgtpdah3cm5srfb97 my_config 3 minutes ago 3 minutes ago
|
eo7jnzguqgtpdah3cm5srfb97 my_config 3 minutes ago 3 minutes ago
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker config inspect config.json
|
$ docker config inspect config.json
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -86,7 +86,7 @@ examples: |-
|
||||||
config. The following example command outputs the creation time of the
|
config. The following example command outputs the creation time of the
|
||||||
config.
|
config.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker config inspect --format='{{.CreatedAt}}' eo7jnzguqgtpdah3cm5srfb97
|
$ docker config inspect --format='{{.CreatedAt}}' eo7jnzguqgtpdah3cm5srfb97
|
||||||
|
|
||||||
2017-03-24 08:15:09.735271783 +0000 UTC
|
2017-03-24 08:15:09.735271783 +0000 UTC
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ options:
|
||||||
kubernetes: false
|
kubernetes: false
|
||||||
swarm: false
|
swarm: false
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker config ls
|
$ docker config ls
|
||||||
|
|
||||||
ID NAME CREATED UPDATED
|
ID NAME CREATED UPDATED
|
||||||
|
|
@ -68,7 +68,7 @@ examples: |-
|
||||||
|
|
||||||
The `id` filter matches all or prefix of a config's id.
|
The `id` filter matches all or prefix of a config's id.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker config ls -f "id=6697bflskwj1998km1gnnjr38"
|
$ docker config ls -f "id=6697bflskwj1998km1gnnjr38"
|
||||||
|
|
||||||
ID NAME CREATED UPDATED
|
ID NAME CREATED UPDATED
|
||||||
|
|
@ -83,7 +83,7 @@ examples: |-
|
||||||
The following filter matches all configs with a `project` label regardless of
|
The following filter matches all configs with a `project` label regardless of
|
||||||
its value:
|
its value:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker config ls --filter label=project
|
$ docker config ls --filter label=project
|
||||||
|
|
||||||
ID NAME CREATED UPDATED
|
ID NAME CREATED UPDATED
|
||||||
|
|
@ -93,7 +93,7 @@ examples: |-
|
||||||
The following filter matches only services with the `project` label with the
|
The following filter matches only services with the `project` label with the
|
||||||
`project-a` value.
|
`project-a` value.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ls --filter label=project=test
|
$ docker service ls --filter label=project=test
|
||||||
|
|
||||||
ID NAME CREATED UPDATED
|
ID NAME CREATED UPDATED
|
||||||
|
|
@ -106,7 +106,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches config with a name containing a prefix of `test`.
|
The following filter matches config with a name containing a prefix of `test`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker config ls --filter name=test_config
|
$ docker config ls --filter name=test_config
|
||||||
|
|
||||||
ID NAME CREATED UPDATED
|
ID NAME CREATED UPDATED
|
||||||
|
|
@ -136,7 +136,7 @@ examples: |-
|
||||||
The following example uses a template without headers and outputs the
|
The following example uses a template without headers and outputs the
|
||||||
`ID` and `Name` entries separated by a colon (`:`) for all images:
|
`ID` and `Name` entries separated by a colon (`:`) for all images:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker config ls --format "{{.ID}}: {{.Name}}"
|
$ docker config ls --format "{{.ID}}: {{.Name}}"
|
||||||
|
|
||||||
77af4d6b9913: config-1
|
77af4d6b9913: config-1
|
||||||
|
|
@ -147,7 +147,7 @@ examples: |-
|
||||||
To list all configs with their name and created date in a table format you
|
To list all configs with their name and created date in a table format you
|
||||||
can use:
|
can use:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker config ls --format "table {{.ID}}\t{{.Name}}\t{{.CreatedAt}}"
|
$ docker config ls --format "table {{.ID}}\t{{.Name}}\t{{.CreatedAt}}"
|
||||||
|
|
||||||
ID NAME CREATED
|
ID NAME CREATED
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ plink: docker_config.yaml
|
||||||
examples: |-
|
examples: |-
|
||||||
This example removes a config:
|
This example removes a config:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker config rm my_config
|
$ docker config rm my_config
|
||||||
sapth4csdo5b6wz2p5uimh5xg
|
sapth4csdo5b6wz2p5uimh5xg
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### Prune containers
|
### Prune containers
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker container prune
|
$ docker container prune
|
||||||
WARNING! This will remove all stopped containers.
|
WARNING! This will remove all stopped containers.
|
||||||
Are you sure you want to continue? [y/N] y
|
Are you sure you want to continue? [y/N] y
|
||||||
|
|
@ -66,7 +66,7 @@ examples: |-
|
||||||
|
|
||||||
The following removes containers created more than 5 minutes ago:
|
The following removes containers created more than 5 minutes ago:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}'
|
$ docker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}'
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED AT STATUS
|
CONTAINER ID IMAGE COMMAND CREATED AT STATUS
|
||||||
|
|
@ -88,7 +88,7 @@ examples: |-
|
||||||
|
|
||||||
The following removes containers created before `2017-01-04T13:10:00`:
|
The following removes containers created before `2017-01-04T13:10:00`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}'
|
$ docker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}'
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED AT STATUS
|
CONTAINER ID IMAGE COMMAND CREATED AT STATUS
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ examples: |-
|
||||||
with a docker endpoint of `/var/run/docker.sock` and a kubernetes configuration
|
with a docker endpoint of `/var/run/docker.sock` and a kubernetes configuration
|
||||||
sourced from the file `/home/me/my-kube-config`:
|
sourced from the file `/home/me/my-kube-config`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker context create \
|
$ docker context create \
|
||||||
--docker host=unix:///var/run/docker.sock \
|
--docker host=unix:///var/run/docker.sock \
|
||||||
--kubernetes config-file=/home/me/my-kube-config \
|
--kubernetes config-file=/home/me/my-kube-config \
|
||||||
|
|
@ -71,19 +71,19 @@ examples: |-
|
||||||
an existing context. The example below creates a new context named `my-context`
|
an existing context. The example below creates a new context named `my-context`
|
||||||
from the existing context `existing-context`:
|
from the existing context `existing-context`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker context create --from existing-context my-context
|
$ docker context create --from existing-context my-context
|
||||||
```
|
```
|
||||||
|
|
||||||
If the `--from` option is not set, the `context` is created from the current context:
|
If the `--from` option is not set, the `context` is created from the current context:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker context create my-context
|
$ docker context create my-context
|
||||||
```
|
```
|
||||||
|
|
||||||
This can be used to create a context out of an existing `DOCKER_HOST` based script:
|
This can be used to create a context out of an existing `DOCKER_HOST` based script:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ source my-setup-script.sh
|
$ source my-setup-script.sh
|
||||||
$ docker context create my-context
|
$ docker context create my-context
|
||||||
```
|
```
|
||||||
|
|
@ -94,7 +94,7 @@ examples: |-
|
||||||
the existing context `existing-context` and a kubernetes configuration sourced
|
the existing context `existing-context` and a kubernetes configuration sourced
|
||||||
from the file `/home/me/my-kube-config`:
|
from the file `/home/me/my-kube-config`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker context create \
|
$ docker context create \
|
||||||
--docker from=existing-context \
|
--docker from=existing-context \
|
||||||
--kubernetes config-file=/home/me/my-kube-config \
|
--kubernetes config-file=/home/me/my-kube-config \
|
||||||
|
|
@ -106,7 +106,7 @@ examples: |-
|
||||||
context named `my-context` using the kuberentes configuration from the existing
|
context named `my-context` using the kuberentes configuration from the existing
|
||||||
context `existing-context` and a docker endpoint of `/var/run/docker.sock`:
|
context `existing-context` and a docker endpoint of `/var/run/docker.sock`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker context create \
|
$ docker context create \
|
||||||
--docker host=unix:///var/run/docker.sock \
|
--docker host=unix:///var/run/docker.sock \
|
||||||
--kubernetes from=existing-context \
|
--kubernetes from=existing-context \
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### Inspect a context by name
|
### Inspect a context by name
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker context inspect "local+aks"
|
$ docker context inspect "local+aks"
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,9 @@ examples: |-
|
||||||
Use `docker context ls` to print all contexts. The currently active context is
|
Use `docker context ls` to print all contexts. The currently active context is
|
||||||
indicated with an `*`:
|
indicated with an `*`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
|
$ docker context ls
|
||||||
|
|
||||||
NAME DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR
|
NAME DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR
|
||||||
default * Current DOCKER_HOST based configuration unix:///var/run/docker.sock swarm
|
default * Current DOCKER_HOST based configuration unix:///var/run/docker.sock swarm
|
||||||
production tcp:///prod.corp.example.com:2376
|
production tcp:///prod.corp.example.com:2376
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### Update an existing context
|
### Update an existing context
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker context update \
|
$ docker context update \
|
||||||
--description "some description" \
|
--description "some description" \
|
||||||
--docker "host=tcp://myserver:2376,ca=~/ca-file,cert=~/cert-file,key=~/key-file" \
|
--docker "host=tcp://myserver:2376,ca=~/ca-file,cert=~/cert-file,key=~/key-file" \
|
||||||
|
|
|
||||||
|
|
@ -71,11 +71,11 @@ long: |-
|
||||||
running `tar` in `docker exec`. Both of the following examples do the same thing
|
running `tar` in `docker exec`. Both of the following examples do the same thing
|
||||||
in different ways (consider `SRC_PATH` and `DEST_PATH` are directories):
|
in different ways (consider `SRC_PATH` and `DEST_PATH` are directories):
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker exec CONTAINER tar Ccf $(dirname SRC_PATH) - $(basename SRC_PATH) | tar Cxf DEST_PATH -
|
$ docker exec CONTAINER tar Ccf $(dirname SRC_PATH) - $(basename SRC_PATH) | tar Cxf DEST_PATH -
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ tar Ccf $(dirname SRC_PATH) - $(basename SRC_PATH) | docker exec -i CONTAINER tar Cxf DEST_PATH -
|
$ tar Ccf $(dirname SRC_PATH) - $(basename SRC_PATH) | docker exec -i CONTAINER tar Cxf DEST_PATH -
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -900,7 +900,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### Create and start a container
|
### Create and start a container
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker create -t -i fedora bash
|
$ docker create -t -i fedora bash
|
||||||
|
|
||||||
6d8af538ec541dd581ebc2a24153a28329acb5268abe5ef868c1f1a261221752
|
6d8af538ec541dd581ebc2a24153a28329acb5268abe5ef868c1f1a261221752
|
||||||
|
|
@ -916,7 +916,7 @@ examples: |-
|
||||||
(i.e., `docker run` too). For example, this allows you to `create` the `data`
|
(i.e., `docker run` too). For example, this allows you to `create` the `data`
|
||||||
volume container, and then use it from another container:
|
volume container, and then use it from another container:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker create -v /data --name data ubuntu
|
$ docker create -v /data --name data ubuntu
|
||||||
|
|
||||||
240633dfbb98128fa77473d3d9018f6123b99c454b3251427ae190a7d951ad57
|
240633dfbb98128fa77473d3d9018f6123b99c454b3251427ae190a7d951ad57
|
||||||
|
|
@ -931,7 +931,7 @@ examples: |-
|
||||||
Similarly, `create` a host directory bind mounted volume container, which can
|
Similarly, `create` a host directory bind mounted volume container, which can
|
||||||
then be used from the subsequent container:
|
then be used from the subsequent container:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker create -v /home/docker:/docker --name docker ubuntu
|
$ docker create -v /home/docker:/docker --name docker ubuntu
|
||||||
|
|
||||||
9aa88c08f319cd1e4515c3c46b0de7cc9aa75e878357b1e96f91e2c773029f03
|
9aa88c08f319cd1e4515c3c46b0de7cc9aa75e878357b1e96f91e2c773029f03
|
||||||
|
|
@ -953,7 +953,7 @@ examples: |-
|
||||||
|
|
||||||
Set storage driver options per container.
|
Set storage driver options per container.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker create -it --storage-opt size=120G fedora /bin/bash
|
$ docker create -it --storage-opt size=120G fedora /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -996,8 +996,8 @@ examples: |-
|
||||||
any number of minor number (added as new devices appear), the
|
any number of minor number (added as new devices appear), the
|
||||||
following rule would be added:
|
following rule would be added:
|
||||||
|
|
||||||
```
|
```console
|
||||||
docker create --device-cgroup-rule='c 42:* rmw' -name my-container my-image
|
$ docker create --device-cgroup-rule='c 42:* rmw' -name my-container my-image
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, a user could ask `udev` to execute a script that would `docker exec my-container mknod newDevX c 42 <minor>`
|
Then, a user could ask `udev` to execute a script that would `docker exec my-container mknod newDevX c 42 <minor>`
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ plink: docker.yaml
|
||||||
examples: |-
|
examples: |-
|
||||||
Inspect the changes to an `nginx` container:
|
Inspect the changes to an `nginx` container:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker diff 1fdfd1f54c1b
|
$ docker diff 1fdfd1f54c1b
|
||||||
|
|
||||||
C /dev
|
C /dev
|
||||||
|
|
|
||||||
|
|
@ -223,13 +223,13 @@ examples: |-
|
||||||
|
|
||||||
**Shell 1: Listening for events:**
|
**Shell 1: Listening for events:**
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker events
|
$ docker events
|
||||||
```
|
```
|
||||||
|
|
||||||
**Shell 2: Start and Stop containers:**
|
**Shell 2: Start and Stop containers:**
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker create --name test alpine:latest top
|
$ docker create --name test alpine:latest top
|
||||||
$ docker start test
|
$ docker start test
|
||||||
$ docker stop test
|
$ docker stop test
|
||||||
|
|
@ -254,7 +254,7 @@ examples: |-
|
||||||
You can filter the output by an absolute timestamp or relative time on the host
|
You can filter the output by an absolute timestamp or relative time on the host
|
||||||
machine, using the following different time syntaxes:
|
machine, using the following different time syntaxes:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker events --since 1483283804
|
$ docker events --since 1483283804
|
||||||
2017-01-05T00:35:41.241772953+08:00 volume create testVol (driver=local)
|
2017-01-05T00:35:41.241772953+08:00 volume create testVol (driver=local)
|
||||||
2017-01-05T00:35:58.859401177+08:00 container create d9cd...4d70 (image=alpine:latest, name=test)
|
2017-01-05T00:35:58.859401177+08:00 container create d9cd...4d70 (image=alpine:latest, name=test)
|
||||||
|
|
@ -307,7 +307,7 @@ examples: |-
|
||||||
The following commands show several different ways to filter the `docker event`
|
The following commands show several different ways to filter the `docker event`
|
||||||
output.
|
output.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker events --filter 'event=stop'
|
$ docker events --filter 'event=stop'
|
||||||
|
|
||||||
2017-01-05T00:40:22.880175420+08:00 container stop 0fdb...ff37 (image=alpine:latest, name=test)
|
2017-01-05T00:40:22.880175420+08:00 container stop 0fdb...ff37 (image=alpine:latest, name=test)
|
||||||
|
|
@ -403,7 +403,7 @@ examples: |-
|
||||||
|
|
||||||
### Format the output
|
### Format the output
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker events --filter 'type=container' --format 'Type={{.Type}} Status={{.Status}} ID={{.ID}}'
|
$ docker events --filter 'type=container' --format 'Type={{.Type}} Status={{.Status}} ID={{.ID}}'
|
||||||
|
|
||||||
Type=container Status=create ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
Type=container Status=create ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
||||||
|
|
@ -416,7 +416,7 @@ examples: |-
|
||||||
|
|
||||||
#### Format as JSON
|
#### Format as JSON
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker events --format '{{json .}}'
|
$ docker events --format '{{json .}}'
|
||||||
|
|
||||||
{"status":"create","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
|
{"status":"create","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ examples: |-
|
||||||
|
|
||||||
First, start a container.
|
First, start a container.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run --name ubuntu_bash --rm -i -t ubuntu bash
|
$ docker run --name ubuntu_bash --rm -i -t ubuntu bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -116,7 +116,7 @@ examples: |-
|
||||||
|
|
||||||
Next, execute a command on the container.
|
Next, execute a command on the container.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker exec -d ubuntu_bash touch /tmp/execWorks
|
$ docker exec -d ubuntu_bash touch /tmp/execWorks
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -125,7 +125,7 @@ examples: |-
|
||||||
|
|
||||||
Next, execute an interactive `bash` shell on the container.
|
Next, execute an interactive `bash` shell on the container.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker exec -it ubuntu_bash bash
|
$ docker exec -it ubuntu_bash bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -133,7 +133,7 @@ examples: |-
|
||||||
|
|
||||||
Next, set an environment variable in the current bash session.
|
Next, set an environment variable in the current bash session.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker exec -it -e VAR=1 ubuntu_bash bash
|
$ docker exec -it -e VAR=1 ubuntu_bash bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -143,14 +143,14 @@ examples: |-
|
||||||
|
|
||||||
By default `docker exec` command runs in the same working directory set when container was created.
|
By default `docker exec` command runs in the same working directory set when container was created.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker exec -it ubuntu_bash pwd
|
$ docker exec -it ubuntu_bash pwd
|
||||||
/
|
/
|
||||||
```
|
```
|
||||||
|
|
||||||
You can select working directory for the command to execute into
|
You can select working directory for the command to execute into
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker exec -it -w /root ubuntu_bash pwd
|
$ docker exec -it -w /root ubuntu_bash pwd
|
||||||
/root
|
/root
|
||||||
```
|
```
|
||||||
|
|
@ -160,7 +160,7 @@ examples: |-
|
||||||
|
|
||||||
If the container is paused, then the `docker exec` command will fail with an error:
|
If the container is paused, then the `docker exec` command will fail with an error:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker pause test
|
$ docker pause test
|
||||||
|
|
||||||
test
|
test
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,11 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
Each of these commands has the same result.
|
Each of these commands has the same result.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker export red_panda > latest.tar
|
$ docker export red_panda > latest.tar
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker export --output="latest.tar" red_panda
|
$ docker export --output="latest.tar" red_panda
|
||||||
```
|
```
|
||||||
deprecated: false
|
deprecated: false
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
To see how the `docker:latest` image was built:
|
To see how the `docker:latest` image was built:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker history docker
|
$ docker history docker
|
||||||
|
|
||||||
IMAGE CREATED CREATED BY SIZE COMMENT
|
IMAGE CREATED CREATED BY SIZE COMMENT
|
||||||
|
|
@ -59,7 +59,7 @@ examples: |-
|
||||||
|
|
||||||
To see how the `docker:apache` image was added to a container's base image:
|
To see how the `docker:apache` image was added to a container's base image:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker history docker:scm
|
$ docker history docker:scm
|
||||||
IMAGE CREATED CREATED BY SIZE COMMENT
|
IMAGE CREATED CREATED BY SIZE COMMENT
|
||||||
2ac9d1098bf1 3 months ago /bin/bash 241.4 MB Added Apache to Fedora base image
|
2ac9d1098bf1 3 months ago /bin/bash 241.4 MB Added Apache to Fedora base image
|
||||||
|
|
@ -92,7 +92,7 @@ examples: |-
|
||||||
`ID` and `CreatedSince` entries separated by a colon (`:`) for the `busybox`
|
`ID` and `CreatedSince` entries separated by a colon (`:`) for the `busybox`
|
||||||
image:
|
image:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker history --format "{{.ID}}: {{.CreatedSince}}" busybox
|
$ docker history --format "{{.ID}}: {{.CreatedSince}}" busybox
|
||||||
|
|
||||||
f6e427c148a7: 4 weeks ago
|
f6e427c148a7: 4 weeks ago
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
Example output:
|
Example output:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker image prune -a
|
$ docker image prune -a
|
||||||
|
|
||||||
WARNING! This will remove all images without at least one container associated to them.
|
WARNING! This will remove all images without at least one container associated to them.
|
||||||
|
|
@ -112,7 +112,7 @@ examples: |-
|
||||||
|
|
||||||
The following removes images created before `2017-01-04T00:00:00`:
|
The following removes images created before `2017-01-04T00:00:00`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images --format 'table {{.Repository}}\t{{.Tag}}\t{{.ID}}\t{{.CreatedAt}}\t{{.Size}}'
|
$ docker images --format 'table {{.Repository}}\t{{.Tag}}\t{{.ID}}\t{{.CreatedAt}}\t{{.Size}}'
|
||||||
REPOSITORY TAG IMAGE ID CREATED AT SIZE
|
REPOSITORY TAG IMAGE ID CREATED AT SIZE
|
||||||
foo latest 2f287ac753da 2017-01-04 13:42:23 -0800 PST 3.98 MB
|
foo latest 2f287ac753da 2017-01-04 13:42:23 -0800 PST 3.98 MB
|
||||||
|
|
@ -139,7 +139,7 @@ examples: |-
|
||||||
|
|
||||||
The following removes images created more than 10 days (`240h`) ago:
|
The following removes images created more than 10 days (`240h`) ago:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images
|
$ docker images
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -179,25 +179,25 @@ examples: |-
|
||||||
|
|
||||||
The following example removes images with the label `deprecated`:
|
The following example removes images with the label `deprecated`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker image prune --filter="label=deprecated"
|
$ docker image prune --filter="label=deprecated"
|
||||||
```
|
```
|
||||||
|
|
||||||
The following example removes images with the label `maintainer` set to `john`:
|
The following example removes images with the label `maintainer` set to `john`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker image prune --filter="label=maintainer=john"
|
$ docker image prune --filter="label=maintainer=john"
|
||||||
```
|
```
|
||||||
|
|
||||||
This example removes images which have no `maintainer` label:
|
This example removes images which have no `maintainer` label:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker image prune --filter="label!=maintainer"
|
$ docker image prune --filter="label!=maintainer"
|
||||||
```
|
```
|
||||||
|
|
||||||
This example removes images which have a maintainer label not set to `john`:
|
This example removes images which have a maintainer label not set to `john`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker image prune --filter="label!=maintainer=john"
|
$ docker image prune --filter="label!=maintainer=john"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### List the most recently created images
|
### List the most recently created images
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images
|
$ docker images
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -102,7 +102,7 @@ examples: |-
|
||||||
|
|
||||||
For example, to list all images in the "java" repository, run this command :
|
For example, to list all images in the "java" repository, run this command :
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images java
|
$ docker images java
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -118,7 +118,7 @@ examples: |-
|
||||||
repository and tag are listed. To find all local images in the "java"
|
repository and tag are listed. To find all local images in the "java"
|
||||||
repository with tag "8" you can use:
|
repository with tag "8" you can use:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images java:8
|
$ docker images java:8
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -127,7 +127,7 @@ examples: |-
|
||||||
|
|
||||||
If nothing matches `REPOSITORY[:TAG]`, the list is empty.
|
If nothing matches `REPOSITORY[:TAG]`, the list is empty.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images java:0
|
$ docker images java:0
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -135,7 +135,7 @@ examples: |-
|
||||||
|
|
||||||
### List the full length image IDs
|
### List the full length image IDs
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images --no-trunc
|
$ docker images --no-trunc
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -157,7 +157,7 @@ examples: |-
|
||||||
unchanged, the digest value is predictable. To list image digest values, use
|
unchanged, the digest value is predictable. To list image digest values, use
|
||||||
the `--digests` flag:
|
the `--digests` flag:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images --digests
|
$ docker images --digests
|
||||||
REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE
|
REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE
|
||||||
localhost:5000/test/busybox <none> sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf 4986bf8c1536 9 weeks ago 2.43 MB
|
localhost:5000/test/busybox <none> sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf 4986bf8c1536 9 weeks ago 2.43 MB
|
||||||
|
|
@ -183,7 +183,7 @@ examples: |-
|
||||||
|
|
||||||
#### Show untagged images (dangling)
|
#### Show untagged images (dangling)
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images --filter "dangling=true"
|
$ docker images --filter "dangling=true"
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -203,7 +203,7 @@ examples: |-
|
||||||
|
|
||||||
You can use this in conjunction with `docker rmi ...`:
|
You can use this in conjunction with `docker rmi ...`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker rmi $(docker images -f "dangling=true" -q)
|
$ docker rmi $(docker images -f "dangling=true" -q)
|
||||||
|
|
||||||
8abc22fbb042
|
8abc22fbb042
|
||||||
|
|
@ -224,7 +224,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches images with the `com.example.version` label regardless of its value.
|
The following filter matches images with the `com.example.version` label regardless of its value.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images --filter "label=com.example.version"
|
$ docker images --filter "label=com.example.version"
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -234,7 +234,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches images with the `com.example.version` label with the `1.0` value.
|
The following filter matches images with the `com.example.version` label with the `1.0` value.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images --filter "label=com.example.version=1.0"
|
$ docker images --filter "label=com.example.version=1.0"
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -243,7 +243,7 @@ examples: |-
|
||||||
|
|
||||||
In this example, with the `0.1` value, it returns an empty set because no matches were found.
|
In this example, with the `0.1` value, it returns an empty set because no matches were found.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images --filter "label=com.example.version=0.1"
|
$ docker images --filter "label=com.example.version=0.1"
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
```
|
```
|
||||||
|
|
@ -253,7 +253,7 @@ examples: |-
|
||||||
The `before` filter shows only images created before the image with
|
The `before` filter shows only images created before the image with
|
||||||
given id or reference. For example, having these images:
|
given id or reference. For example, having these images:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images
|
$ docker images
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -264,7 +264,7 @@ examples: |-
|
||||||
|
|
||||||
Filtering with `before` would give:
|
Filtering with `before` would give:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images --filter "before=image1"
|
$ docker images --filter "before=image1"
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -274,7 +274,7 @@ examples: |-
|
||||||
|
|
||||||
Filtering with `since` would give:
|
Filtering with `since` would give:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images --filter "since=image3"
|
$ docker images --filter "since=image3"
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
image1 latest eeae25ada2aa 4 minutes ago 188.3 MB
|
image1 latest eeae25ada2aa 4 minutes ago 188.3 MB
|
||||||
|
|
@ -286,7 +286,7 @@ examples: |-
|
||||||
The `reference` filter shows only images whose reference matches
|
The `reference` filter shows only images whose reference matches
|
||||||
the specified pattern.
|
the specified pattern.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images
|
$ docker images
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -298,7 +298,7 @@ examples: |-
|
||||||
|
|
||||||
Filtering with `reference` would give:
|
Filtering with `reference` would give:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images --filter=reference='busy*:*libc'
|
$ docker images --filter=reference='busy*:*libc'
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -308,7 +308,7 @@ examples: |-
|
||||||
|
|
||||||
Filtering with multiple `reference` would give, either match A or B:
|
Filtering with multiple `reference` would give, either match A or B:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images --filter=reference='busy*:uclibc' --filter=reference='busy*:glibc'
|
$ docker images --filter=reference='busy*:uclibc' --filter=reference='busy*:glibc'
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -340,7 +340,7 @@ examples: |-
|
||||||
The following example uses a template without headers and outputs the
|
The following example uses a template without headers and outputs the
|
||||||
`ID` and `Repository` entries separated by a colon (`:`) for all images:
|
`ID` and `Repository` entries separated by a colon (`:`) for all images:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images --format "{{.ID}}: {{.Repository}}"
|
$ docker images --format "{{.ID}}: {{.Repository}}"
|
||||||
|
|
||||||
77af4d6b9913: <none>
|
77af4d6b9913: <none>
|
||||||
|
|
@ -357,7 +357,7 @@ examples: |-
|
||||||
To list all images with their repository and tag in a table format you
|
To list all images with their repository and tag in a table format you
|
||||||
can use:
|
can use:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}"
|
$ docker images --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}"
|
||||||
|
|
||||||
IMAGE ID REPOSITORY TAG
|
IMAGE ID REPOSITORY TAG
|
||||||
|
|
|
||||||
|
|
@ -49,39 +49,39 @@ examples: |-
|
||||||
|
|
||||||
This will create a new untagged image.
|
This will create a new untagged image.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker import http://example.com/exampleimage.tgz
|
$ docker import https://example.com/exampleimage.tgz
|
||||||
```
|
```
|
||||||
|
|
||||||
### Import from a local file
|
### Import from a local file
|
||||||
|
|
||||||
- Import to docker via pipe and `STDIN`.
|
Import to docker via pipe and `STDIN`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ cat exampleimage.tgz | docker import - exampleimagelocal:new
|
$ cat exampleimage.tgz | docker import - exampleimagelocal:new
|
||||||
```
|
```
|
||||||
|
|
||||||
- Import with a commit message.
|
Import with a commit message.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ cat exampleimage.tgz | docker import --message "New image imported from tarball" - exampleimagelocal:new
|
$ cat exampleimage.tgz | docker import --message "New image imported from tarball" - exampleimagelocal:new
|
||||||
```
|
```
|
||||||
|
|
||||||
- Import to docker from a local archive.
|
Import to docker from a local archive.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker import /path/to/exampleimage.tgz
|
$ docker import /path/to/exampleimage.tgz
|
||||||
```
|
```
|
||||||
|
|
||||||
### Import from a local directory
|
### Import from a local directory
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo tar -c . | docker import - exampleimagedir
|
$ sudo tar -c . | docker import - exampleimagedir
|
||||||
```
|
```
|
||||||
|
|
||||||
### Import from a local directory with new configurations
|
### Import from a local directory with new configurations
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo tar -c . | docker import --change "ENV DEBUG=true" - exampleimagedir
|
$ sudo tar -c . | docker import --change "ENV DEBUG=true" - exampleimagedir
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,9 @@ examples: |-
|
||||||
using the `devicemapper` storage driver. As can be seen in the output, additional
|
using the `devicemapper` storage driver. As can be seen in the output, additional
|
||||||
information about the `devicemapper` storage driver is shown:
|
information about the `devicemapper` storage driver is shown:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker info
|
$ docker info
|
||||||
|
|
||||||
Client:
|
Client:
|
||||||
Context: default
|
Context: default
|
||||||
Debug Mode: false
|
Debug Mode: false
|
||||||
|
|
@ -98,8 +99,9 @@ examples: |-
|
||||||
Here is a sample output for a daemon running on Ubuntu, using the overlay2
|
Here is a sample output for a daemon running on Ubuntu, using the overlay2
|
||||||
storage driver and a node that is part of a 2-node swarm:
|
storage driver and a node that is part of a 2-node swarm:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker -D info
|
$ docker --debug info
|
||||||
|
|
||||||
Client:
|
Client:
|
||||||
Context: default
|
Context: default
|
||||||
Debug Mode: true
|
Debug Mode: true
|
||||||
|
|
@ -188,7 +190,7 @@ examples: |-
|
||||||
|
|
||||||
You can also specify the output format:
|
You can also specify the output format:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker info --format '{{json .}}'
|
$ docker info --format '{{json .}}'
|
||||||
|
|
||||||
{"ID":"I54V:OLXT:HVMM:TPKO:JPHQ:CQCD:JNLC:O3BZ:4ZVJ:43XJ:PFHZ:6N2S","Containers":14, ...}
|
{"ID":"I54V:OLXT:HVMM:TPKO:JPHQ:CQCD:JNLC:O3BZ:4ZVJ:43XJ:PFHZ:6N2S","Containers":14, ...}
|
||||||
|
|
|
||||||
|
|
@ -41,25 +41,25 @@ examples: |-
|
||||||
For the most part, you can pick out any field from the JSON in a fairly
|
For the most part, you can pick out any field from the JSON in a fairly
|
||||||
straightforward manner.
|
straightforward manner.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $INSTANCE_ID
|
$ docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $INSTANCE_ID
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get an instance's MAC address
|
### Get an instance's MAC address
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker inspect --format='{{range .NetworkSettings.Networks}}{{.MacAddress}}{{end}}' $INSTANCE_ID
|
$ docker inspect --format='{{range .NetworkSettings.Networks}}{{.MacAddress}}{{end}}' $INSTANCE_ID
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get an instance's log path
|
### Get an instance's log path
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker inspect --format='{{.LogPath}}' $INSTANCE_ID
|
$ docker inspect --format='{{.LogPath}}' $INSTANCE_ID
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get an instance's image name
|
### Get an instance's image name
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker inspect --format='{{.Config.Image}}' $INSTANCE_ID
|
$ docker inspect --format='{{.Config.Image}}' $INSTANCE_ID
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -68,7 +68,7 @@ examples: |-
|
||||||
You can loop over arrays and maps in the results to produce simple text
|
You can loop over arrays and maps in the results to produce simple text
|
||||||
output:
|
output:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' $INSTANCE_ID
|
$ docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' $INSTANCE_ID
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -82,7 +82,7 @@ examples: |-
|
||||||
then `index` 0 contains the first object inside of that. Then we ask for
|
then `index` 0 contains the first object inside of that. Then we ask for
|
||||||
the `HostPort` field to get the public address.
|
the `HostPort` field to get the public address.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker inspect --format='{{(index (index .NetworkSettings.Ports "8787/tcp") 0).HostPort}}' $INSTANCE_ID
|
$ docker inspect --format='{{(index (index .NetworkSettings.Ports "8787/tcp") 0).HostPort}}' $INSTANCE_ID
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -93,7 +93,7 @@ examples: |-
|
||||||
Docker adds a template function, `json`, which can be applied to get
|
Docker adds a template function, `json`, which can be applied to get
|
||||||
results in JSON format.
|
results in JSON format.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker inspect --format='{{json .Config}}' $INSTANCE_ID
|
$ docker inspect --format='{{json .Config}}' $INSTANCE_ID
|
||||||
```
|
```
|
||||||
deprecated: false
|
deprecated: false
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,18 @@ short: Kill one or more running containers
|
||||||
long: |-
|
long: |-
|
||||||
The `docker kill` subcommand kills one or more containers. The main process
|
The `docker kill` subcommand kills one or more containers. The main process
|
||||||
inside the container is sent `SIGKILL` signal (default), or the signal that is
|
inside the container is sent `SIGKILL` signal (default), or the signal that is
|
||||||
specified with the `--signal` option. You can kill a container using the
|
specified with the `--signal` option. You can reference a container by its
|
||||||
container's ID, ID-prefix, or name.
|
ID, ID-prefix, or name.
|
||||||
|
|
||||||
|
The `--signal` (or `-s` shorthand) flag sets the system call signal that is sent
|
||||||
|
to the container. This signal can be a signal name in the format `SIG<NAME>`, for
|
||||||
|
instance `SIGINT`, or an unsigned number that matches a position in the kernel's
|
||||||
|
syscall table, for instance `2`.
|
||||||
|
|
||||||
|
While the default (`SIGKILL`) signal will terminate the container, the signal
|
||||||
|
set through `--signal` may be non-terminal, depending on the container's main
|
||||||
|
process. For example, the `SIGHUP` signal in most cases will be non-terminal,
|
||||||
|
and the container will continue running after receiving the signal.
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
|
|
@ -26,21 +36,21 @@ options:
|
||||||
kubernetes: false
|
kubernetes: false
|
||||||
swarm: false
|
swarm: false
|
||||||
examples: |-
|
examples: |-
|
||||||
### Send a KILL signal to a container
|
### Send a KILL signal to a container
|
||||||
|
|
||||||
The following example sends the default `KILL` signal to the container named
|
The following example sends the default `SIGKILL` signal to the container named
|
||||||
`my_container`:
|
`my_container`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker kill my_container
|
$ docker kill my_container
|
||||||
```
|
```
|
||||||
|
|
||||||
### Send a custom signal to a container
|
### Send a custom signal to a container
|
||||||
|
|
||||||
The following example sends a `SIGHUP` signal to the container named
|
The following example sends a `SIGHUP` signal to the container named
|
||||||
`my_container`:
|
`my_container`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker kill --signal=SIGHUP my_container
|
$ docker kill --signal=SIGHUP my_container
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -48,7 +58,7 @@ examples: |-
|
||||||
You can specify a custom signal either by _name_, or _number_. The `SIG` prefix
|
You can specify a custom signal either by _name_, or _number_. The `SIG` prefix
|
||||||
is optional, so the following examples are equivalent:
|
is optional, so the following examples are equivalent:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker kill --signal=SIGHUP my_container
|
$ docker kill --signal=SIGHUP my_container
|
||||||
$ docker kill --signal=HUP my_container
|
$ docker kill --signal=HUP my_container
|
||||||
$ docker kill --signal=1 my_container
|
$ docker kill --signal=1 my_container
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ options:
|
||||||
kubernetes: false
|
kubernetes: false
|
||||||
swarm: false
|
swarm: false
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker image ls
|
$ docker image ls
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ examples: |-
|
||||||
If you want to login to a self-hosted registry you can specify this by
|
If you want to login to a self-hosted registry you can specify this by
|
||||||
adding the server name.
|
adding the server name.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker login localhost:8080
|
$ docker login localhost:8080
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@ examples: |-
|
||||||
The following example reads a password from a file, and passes it to the
|
The following example reads a password from a file, and passes it to the
|
||||||
`docker login` command using `STDIN`:
|
`docker login` command using `STDIN`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ cat ~/my_password.txt | docker login --username foo --password-stdin
|
$ cat ~/my_password.txt | docker login --username foo --password-stdin
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ usage: docker logout [SERVER]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker logout localhost:8080
|
$ docker logout localhost:8080
|
||||||
```
|
```
|
||||||
deprecated: false
|
deprecated: false
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ examples: |-
|
||||||
|
|
||||||
In order to retrieve logs before a specific point in time, run:
|
In order to retrieve logs before a specific point in time, run:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run --name test -d busybox sh -c "while true; do $(echo date); sleep 1; done"
|
$ docker run --name test -d busybox sh -c "while true; do $(echo date); sleep 1; done"
|
||||||
$ date
|
$ date
|
||||||
Tue 14 Nov 2017 16:40:00 CET
|
Tue 14 Nov 2017 16:40:00 CET
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ long: |-
|
||||||
|
|
||||||
### manifest inspect
|
### manifest inspect
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
manifest inspect --help
|
$ docker manifest inspect --help
|
||||||
|
|
||||||
Usage: docker manifest inspect [OPTIONS] [MANIFEST_LIST] MANIFEST
|
Usage: docker manifest inspect [OPTIONS] [MANIFEST_LIST] MANIFEST
|
||||||
|
|
||||||
|
|
@ -34,7 +34,7 @@ long: |-
|
||||||
|
|
||||||
### manifest create
|
### manifest create
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
Usage: docker manifest create MANIFEST_LIST MANIFEST [MANIFEST...]
|
Usage: docker manifest create MANIFEST_LIST MANIFEST [MANIFEST...]
|
||||||
|
|
||||||
Create a local manifest list for annotating and pushing to a registry
|
Create a local manifest list for annotating and pushing to a registry
|
||||||
|
|
@ -47,7 +47,7 @@ long: |-
|
||||||
|
|
||||||
### manifest annotate
|
### manifest annotate
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
Usage: docker manifest annotate [OPTIONS] MANIFEST_LIST MANIFEST
|
Usage: docker manifest annotate [OPTIONS] MANIFEST_LIST MANIFEST
|
||||||
|
|
||||||
Add additional information to a local image manifest
|
Add additional information to a local image manifest
|
||||||
|
|
@ -64,7 +64,7 @@ long: |-
|
||||||
|
|
||||||
### manifest push
|
### manifest push
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
Usage: docker manifest push [OPTIONS] MANIFEST_LIST
|
Usage: docker manifest push [OPTIONS] MANIFEST_LIST
|
||||||
|
|
||||||
Push a manifest list to a repository
|
Push a manifest list to a repository
|
||||||
|
|
@ -105,7 +105,7 @@ clink:
|
||||||
examples: |-
|
examples: |-
|
||||||
### Inspect an image's manifest object
|
### Inspect an image's manifest object
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker manifest inspect hello-world
|
$ docker manifest inspect hello-world
|
||||||
{
|
{
|
||||||
"schemaVersion": 2,
|
"schemaVersion": 2,
|
||||||
|
|
@ -135,7 +135,7 @@ examples: |-
|
||||||
|
|
||||||
Here is an example of inspecting an image's manifest with the `--verbose` flag:
|
Here is an example of inspecting an image's manifest with the `--verbose` flag:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker manifest inspect --verbose hello-world
|
$ docker manifest inspect --verbose hello-world
|
||||||
{
|
{
|
||||||
"Ref": "docker.io/library/hello-world:latest",
|
"Ref": "docker.io/library/hello-world:latest",
|
||||||
|
|
@ -179,7 +179,7 @@ examples: |-
|
||||||
Finally, you need to `push` your manifest list to the desired registry. Below are
|
Finally, you need to `push` your manifest list to the desired registry. Below are
|
||||||
descriptions of these three commands, and an example putting them all together.
|
descriptions of these three commands, and an example putting them all together.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker manifest create 45.55.81.106:5000/coolapp:v1 \
|
$ docker manifest create 45.55.81.106:5000/coolapp:v1 \
|
||||||
45.55.81.106:5000/coolapp-ppc64le-linux:v1 \
|
45.55.81.106:5000/coolapp-ppc64le-linux:v1 \
|
||||||
45.55.81.106:5000/coolapp-arm-linux:v1 \
|
45.55.81.106:5000/coolapp-arm-linux:v1 \
|
||||||
|
|
@ -189,11 +189,11 @@ examples: |-
|
||||||
Created manifest list 45.55.81.106:5000/coolapp:v1
|
Created manifest list 45.55.81.106:5000/coolapp:v1
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker manifest annotate 45.55.81.106:5000/coolapp:v1 45.55.81.106:5000/coolapp-arm-linux --arch arm
|
$ docker manifest annotate 45.55.81.106:5000/coolapp:v1 45.55.81.106:5000/coolapp-arm-linux --arch arm
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker manifest push 45.55.81.106:5000/coolapp:v1
|
$ docker manifest push 45.55.81.106:5000/coolapp:v1
|
||||||
Pushed manifest 45.55.81.106:5000/coolapp@sha256:9701edc932223a66e49dd6c894a11db8c2cf4eccd1414f1ec105a623bf16b426 with digest: sha256:f67dcc5fc786f04f0743abfe0ee5dae9bd8caf8efa6c8144f7f2a43889dc513b
|
Pushed manifest 45.55.81.106:5000/coolapp@sha256:9701edc932223a66e49dd6c894a11db8c2cf4eccd1414f1ec105a623bf16b426 with digest: sha256:f67dcc5fc786f04f0743abfe0ee5dae9bd8caf8efa6c8144f7f2a43889dc513b
|
||||||
Pushed manifest 45.55.81.106:5000/coolapp@sha256:f3b3b28a45160805bb16542c9531888519430e9e6d6ffc09d72261b0d26ff74f with digest: sha256:b64ca0b60356a30971f098c92200b1271257f100a55b351e6bbe985638352f3a
|
Pushed manifest 45.55.81.106:5000/coolapp@sha256:f3b3b28a45160805bb16542c9531888519430e9e6d6ffc09d72261b0d26ff74f with digest: sha256:b64ca0b60356a30971f098c92200b1271257f100a55b351e6bbe985638352f3a
|
||||||
|
|
@ -205,7 +205,7 @@ examples: |-
|
||||||
|
|
||||||
### Inspect a manifest list
|
### Inspect a manifest list
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker manifest inspect coolapp:v1
|
$ docker manifest inspect coolapp:v1
|
||||||
{
|
{
|
||||||
"schemaVersion": 2,
|
"schemaVersion": 2,
|
||||||
|
|
@ -256,7 +256,7 @@ examples: |-
|
||||||
Here is an example of creating and pushing a manifest list using a known
|
Here is an example of creating and pushing a manifest list using a known
|
||||||
insecure registry.
|
insecure registry.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker manifest create --insecure myprivateregistry.mycompany.com/repo/image:1.0 \
|
$ docker manifest create --insecure myprivateregistry.mycompany.com/repo/image:1.0 \
|
||||||
myprivateregistry.mycompany.com/repo/image-linux-ppc64le:1.0 \
|
myprivateregistry.mycompany.com/repo/image-linux-ppc64le:1.0 \
|
||||||
myprivateregistry.mycompany.com/repo/image-linux-s390x:1.0 \
|
myprivateregistry.mycompany.com/repo/image-linux-s390x:1.0 \
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### Connect a running container to a network
|
### Connect a running container to a network
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network connect multi-host-network container1
|
$ docker network connect multi-host-network container1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -70,7 +70,7 @@ examples: |-
|
||||||
|
|
||||||
You can also use the `docker run --network=<network-name>` option to start a container and immediately connect it to a network.
|
You can also use the `docker run --network=<network-name>` option to start a container and immediately connect it to a network.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -itd --network=multi-host-network busybox
|
$ docker run -itd --network=multi-host-network busybox
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -78,7 +78,7 @@ examples: |-
|
||||||
|
|
||||||
You can specify the IP address you want to be assigned to the container's interface.
|
You can specify the IP address you want to be assigned to the container's interface.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network connect --ip 10.10.36.122 multi-host-network container2
|
$ docker network connect --ip 10.10.36.122 multi-host-network container2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -86,7 +86,7 @@ examples: |-
|
||||||
|
|
||||||
You can use `--link` option to link another container with a preferred alias
|
You can use `--link` option to link another container with a preferred alias
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network connect --link container1:c1 multi-host-network container2
|
$ docker network connect --link container1:c1 multi-host-network container2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -95,7 +95,7 @@ examples: |-
|
||||||
`--alias` option can be used to resolve the container by another name in the network
|
`--alias` option can be used to resolve the container by another name in the network
|
||||||
being connected to.
|
being connected to.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network connect --alias db --alias mysql multi-host-network container2
|
$ docker network connect --alias db --alias mysql multi-host-network container2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -111,11 +111,11 @@ examples: |-
|
||||||
address(es) from outside that range. This ensures that the IP address is not
|
address(es) from outside that range. This ensures that the IP address is not
|
||||||
given to another container while this container is not on the network.
|
given to another container while this container is not on the network.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network create --subnet 172.20.0.0/16 --ip-range 172.20.240.0/20 multi-host-network
|
$ docker network create --subnet 172.20.0.0/16 --ip-range 172.20.240.0/20 multi-host-network
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network connect --ip 172.20.128.2 multi-host-network container2
|
$ docker network connect --ip 172.20.128.2 multi-host-network container2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ long: |-
|
||||||
this bridge network. You cannot remove this default bridge network, but you can
|
this bridge network. You cannot remove this default bridge network, but you can
|
||||||
create new ones using the `network create` command.
|
create new ones using the `network create` command.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network create -d bridge my-bridge-network
|
$ docker network create -d bridge my-bridge-network
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ long: |-
|
||||||
Once you have prepared the `overlay` network prerequisites you simply choose a
|
Once you have prepared the `overlay` network prerequisites you simply choose a
|
||||||
Docker host in the cluster and issue the following to create the network:
|
Docker host in the cluster and issue the following to create the network:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network create -d overlay my-multihost-network
|
$ docker network create -d overlay my-multihost-network
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -218,7 +218,7 @@ examples: |-
|
||||||
When you start a container, use the `--network` flag to connect it to a network.
|
When you start a container, use the `--network` flag to connect it to a network.
|
||||||
This example adds the `busybox` container to the `mynet` network:
|
This example adds the `busybox` container to the `mynet` network:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -itd --network=mynet busybox
|
$ docker run -itd --network=mynet busybox
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -242,14 +242,14 @@ examples: |-
|
||||||
and specify subnetwork values directly using the `--subnet` option. On a
|
and specify subnetwork values directly using the `--subnet` option. On a
|
||||||
`bridge` network you can only create a single subnet:
|
`bridge` network you can only create a single subnet:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network create --driver=bridge --subnet=192.168.0.0/16 br0
|
$ docker network create --driver=bridge --subnet=192.168.0.0/16 br0
|
||||||
```
|
```
|
||||||
|
|
||||||
Additionally, you also specify the `--gateway` `--ip-range` and `--aux-address`
|
Additionally, you also specify the `--gateway` `--ip-range` and `--aux-address`
|
||||||
options.
|
options.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network create \
|
$ docker network create \
|
||||||
--driver=bridge \
|
--driver=bridge \
|
||||||
--subnet=172.28.0.0/16 \
|
--subnet=172.28.0.0/16 \
|
||||||
|
|
@ -264,7 +264,7 @@ examples: |-
|
||||||
subnet mask to adhere to the current guidance of not having more than 256 IPs in
|
subnet mask to adhere to the current guidance of not having more than 256 IPs in
|
||||||
a single overlay network. Each of the subnetworks has 126 usable addresses.
|
a single overlay network. Each of the subnetworks has 126 usable addresses.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network create -d overlay \
|
$ docker network create -d overlay \
|
||||||
--subnet=192.168.10.0/25 \
|
--subnet=192.168.10.0/25 \
|
||||||
--subnet=192.168.20.0/25 \
|
--subnet=192.168.20.0/25 \
|
||||||
|
|
@ -307,7 +307,7 @@ examples: |-
|
||||||
For example, let's use `-o` or `--opt` options to specify an IP address binding
|
For example, let's use `-o` or `--opt` options to specify an IP address binding
|
||||||
when publishing ports:
|
when publishing ports:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network create \
|
$ docker network create \
|
||||||
-o "com.docker.network.bridge.host_binding_ipv4"="172.19.0.1" \
|
-o "com.docker.network.bridge.host_binding_ipv4"="172.19.0.1" \
|
||||||
simple-network
|
simple-network
|
||||||
|
|
@ -328,7 +328,7 @@ examples: |-
|
||||||
if no services depend on it. Any option available when creating an overlay network
|
if no services depend on it. Any option available when creating an overlay network
|
||||||
is also available when creating the ingress network, besides the `--attachable` option.
|
is also available when creating the ingress network, besides the `--attachable` option.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network create -d overlay \
|
$ docker network create -d overlay \
|
||||||
--subnet=10.11.0.0/16 \
|
--subnet=10.11.0.0/16 \
|
||||||
--ingress \
|
--ingress \
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ options:
|
||||||
kubernetes: false
|
kubernetes: false
|
||||||
swarm: false
|
swarm: false
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker network disconnect multi-host-network container1
|
$ docker network disconnect multi-host-network container1
|
||||||
```
|
```
|
||||||
deprecated: false
|
deprecated: false
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,8 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### List all networks
|
### List all networks
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ sudo docker network ls
|
$ docker network ls
|
||||||
NETWORK ID NAME DRIVER SCOPE
|
NETWORK ID NAME DRIVER SCOPE
|
||||||
7fca4eb8c647 bridge bridge local
|
7fca4eb8c647 bridge bridge local
|
||||||
9f904ee27bf5 none null local
|
9f904ee27bf5 none null local
|
||||||
|
|
@ -58,7 +58,7 @@ examples: |-
|
||||||
|
|
||||||
Use the `--no-trunc` option to display the full network id:
|
Use the `--no-trunc` option to display the full network id:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network ls --no-trunc
|
$ docker network ls --no-trunc
|
||||||
NETWORK ID NAME DRIVER SCOPE
|
NETWORK ID NAME DRIVER SCOPE
|
||||||
18a2866682b85619a026c81b98a5e375bd33e1b0936a26cc497c283d27bae9b3 none null local
|
18a2866682b85619a026c81b98a5e375bd33e1b0936a26cc497c283d27bae9b3 none null local
|
||||||
|
|
@ -90,7 +90,7 @@ examples: |-
|
||||||
|
|
||||||
The following example matches networks with the `bridge` driver:
|
The following example matches networks with the `bridge` driver:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network ls --filter driver=bridge
|
$ docker network ls --filter driver=bridge
|
||||||
NETWORK ID NAME DRIVER SCOPE
|
NETWORK ID NAME DRIVER SCOPE
|
||||||
db9db329f835 test1 bridge local
|
db9db329f835 test1 bridge local
|
||||||
|
|
@ -104,7 +104,7 @@ examples: |-
|
||||||
The following filter matches all networks with an ID containing the
|
The following filter matches all networks with an ID containing the
|
||||||
`63d1ff1f77b0...` string.
|
`63d1ff1f77b0...` string.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network ls --filter id=63d1ff1f77b07ca51070a8c227e962238358bd310bde1529cf62e6c307ade161
|
$ docker network ls --filter id=63d1ff1f77b07ca51070a8c227e962238358bd310bde1529cf62e6c307ade161
|
||||||
NETWORK ID NAME DRIVER SCOPE
|
NETWORK ID NAME DRIVER SCOPE
|
||||||
63d1ff1f77b0 dev bridge local
|
63d1ff1f77b0 dev bridge local
|
||||||
|
|
@ -112,7 +112,7 @@ examples: |-
|
||||||
|
|
||||||
You can also filter for a substring in an ID as this shows:
|
You can also filter for a substring in an ID as this shows:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network ls --filter id=95e74588f40d
|
$ docker network ls --filter id=95e74588f40d
|
||||||
NETWORK ID NAME DRIVER SCOPE
|
NETWORK ID NAME DRIVER SCOPE
|
||||||
95e74588f40d foo bridge local
|
95e74588f40d foo bridge local
|
||||||
|
|
@ -129,7 +129,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches networks with the `usage` label regardless of its value.
|
The following filter matches networks with the `usage` label regardless of its value.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network ls -f "label=usage"
|
$ docker network ls -f "label=usage"
|
||||||
NETWORK ID NAME DRIVER SCOPE
|
NETWORK ID NAME DRIVER SCOPE
|
||||||
db9db329f835 test1 bridge local
|
db9db329f835 test1 bridge local
|
||||||
|
|
@ -138,7 +138,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches networks with the `usage` label with the `prod` value.
|
The following filter matches networks with the `usage` label with the `prod` value.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network ls -f "label=usage=prod"
|
$ docker network ls -f "label=usage=prod"
|
||||||
NETWORK ID NAME DRIVER SCOPE
|
NETWORK ID NAME DRIVER SCOPE
|
||||||
f6e212da9dfd test2 bridge local
|
f6e212da9dfd test2 bridge local
|
||||||
|
|
@ -150,7 +150,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches all networks with a name containing the `foobar` string.
|
The following filter matches all networks with a name containing the `foobar` string.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network ls --filter name=foobar
|
$ docker network ls --filter name=foobar
|
||||||
NETWORK ID NAME DRIVER SCOPE
|
NETWORK ID NAME DRIVER SCOPE
|
||||||
06e7eef0a170 foobar bridge local
|
06e7eef0a170 foobar bridge local
|
||||||
|
|
@ -158,7 +158,7 @@ examples: |-
|
||||||
|
|
||||||
You can also filter for a substring in a name as this shows:
|
You can also filter for a substring in a name as this shows:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network ls --filter name=foo
|
$ docker network ls --filter name=foo
|
||||||
NETWORK ID NAME DRIVER SCOPE
|
NETWORK ID NAME DRIVER SCOPE
|
||||||
95e74588f40d foo bridge local
|
95e74588f40d foo bridge local
|
||||||
|
|
@ -171,7 +171,7 @@ examples: |-
|
||||||
|
|
||||||
The following example matches networks with the `swarm` scope:
|
The following example matches networks with the `swarm` scope:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network ls --filter scope=swarm
|
$ docker network ls --filter scope=swarm
|
||||||
NETWORK ID NAME DRIVER SCOPE
|
NETWORK ID NAME DRIVER SCOPE
|
||||||
xbtm0v4f1lfh ingress overlay swarm
|
xbtm0v4f1lfh ingress overlay swarm
|
||||||
|
|
@ -180,7 +180,7 @@ examples: |-
|
||||||
|
|
||||||
The following example matches networks with the `local` scope:
|
The following example matches networks with the `local` scope:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network ls --filter scope=local
|
$ docker network ls --filter scope=local
|
||||||
NETWORK ID NAME DRIVER SCOPE
|
NETWORK ID NAME DRIVER SCOPE
|
||||||
e85227439ac7 bridge bridge local
|
e85227439ac7 bridge bridge local
|
||||||
|
|
@ -196,7 +196,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches all user defined networks:
|
The following filter matches all user defined networks:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network ls --filter type=custom
|
$ docker network ls --filter type=custom
|
||||||
NETWORK ID NAME DRIVER SCOPE
|
NETWORK ID NAME DRIVER SCOPE
|
||||||
95e74588f40d foo bridge local
|
95e74588f40d foo bridge local
|
||||||
|
|
@ -206,7 +206,7 @@ examples: |-
|
||||||
By having this flag it allows for batch cleanup. For example, use this filter
|
By having this flag it allows for batch cleanup. For example, use this filter
|
||||||
to delete all user defined networks:
|
to delete all user defined networks:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network rm `docker network ls --filter type=custom -q`
|
$ docker network rm `docker network ls --filter type=custom -q`
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -239,7 +239,7 @@ examples: |-
|
||||||
The following example uses a template without headers and outputs the
|
The following example uses a template without headers and outputs the
|
||||||
`ID` and `Driver` entries separated by a colon (`:`) for all networks:
|
`ID` and `Driver` entries separated by a colon (`:`) for all networks:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network ls --format "{{.ID}}: {{.Driver}}"
|
$ docker network ls --format "{{.ID}}: {{.Driver}}"
|
||||||
afaaab448eb2: bridge
|
afaaab448eb2: bridge
|
||||||
d1584f8dc718: host
|
d1584f8dc718: host
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ options:
|
||||||
kubernetes: false
|
kubernetes: false
|
||||||
swarm: false
|
swarm: false
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker network prune
|
$ docker network prune
|
||||||
|
|
||||||
WARNING! This will remove all custom networks not used by at least one container.
|
WARNING! This will remove all custom networks not used by at least one container.
|
||||||
|
|
@ -66,7 +66,7 @@ examples: |-
|
||||||
The following removes networks created more than 5 minutes ago. Note that
|
The following removes networks created more than 5 minutes ago. Note that
|
||||||
system networks such as `bridge`, `host`, and `none` will never be pruned:
|
system networks such as `bridge`, `host`, and `none` will never be pruned:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network ls
|
$ docker network ls
|
||||||
|
|
||||||
NETWORK ID NAME DRIVER SCOPE
|
NETWORK ID NAME DRIVER SCOPE
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ examples: |-
|
||||||
|
|
||||||
To remove the network named 'my-network':
|
To remove the network named 'my-network':
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network rm my-network
|
$ docker network rm my-network
|
||||||
```
|
```
|
||||||
|
|
||||||
### Remove multiple networks
|
### Remove multiple networks
|
||||||
|
|
@ -22,8 +22,8 @@ examples: |-
|
||||||
multiple network names or ids. The following example deletes a network with id
|
multiple network names or ids. The following example deletes a network with id
|
||||||
`3695c422697f` and a network named `my-network`:
|
`3695c422697f` and a network named `my-network`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network rm 3695c422697f my-network
|
$ docker network rm 3695c422697f my-network
|
||||||
```
|
```
|
||||||
|
|
||||||
When you specify multiple networks, the command attempts to delete each in turn.
|
When you specify multiple networks, the command attempts to delete each in turn.
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ usage: docker node demote NODE [NODE...]
|
||||||
pname: docker node
|
pname: docker node
|
||||||
plink: docker_node.yaml
|
plink: docker_node.yaml
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker node demote <node name>
|
$ docker node demote <node name>
|
||||||
```
|
```
|
||||||
deprecated: false
|
deprecated: false
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### Inspect a node
|
### Inspect a node
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker node inspect swarm-manager
|
$ docker node inspect swarm-manager
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -115,7 +115,7 @@ examples: |-
|
||||||
|
|
||||||
### Specify an output format
|
### Specify an output format
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker node inspect --format '{{ .ManagerStatus.Leader }}' self
|
$ docker node inspect --format '{{ .ManagerStatus.Leader }}' self
|
||||||
|
|
||||||
false
|
false
|
||||||
|
|
@ -123,7 +123,7 @@ examples: |-
|
||||||
|
|
||||||
Use `--format=pretty` or the `--pretty` shorthand to pretty-print the output:
|
Use `--format=pretty` or the `--pretty` shorthand to pretty-print the output:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker node inspect --format=pretty self
|
$ docker node inspect --format=pretty self
|
||||||
|
|
||||||
ID: e216jshn25ckzbvmwlnh5jr3g
|
ID: e216jshn25ckzbvmwlnh5jr3g
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ options:
|
||||||
kubernetes: false
|
kubernetes: false
|
||||||
swarm: false
|
swarm: false
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker node ls
|
$ docker node ls
|
||||||
|
|
||||||
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
||||||
|
|
@ -52,6 +52,7 @@ examples: |-
|
||||||
38ciaotwjuritcdtn9npbnkuz swarm-worker1 Ready Active
|
38ciaotwjuritcdtn9npbnkuz swarm-worker1 Ready Active
|
||||||
e216jshn25ckzbvmwlnh5jr3g * swarm-manager1 Ready Active Leader
|
e216jshn25ckzbvmwlnh5jr3g * swarm-manager1 Ready Active Leader
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
> In the above example output, there is a hidden column of `.Self` that indicates
|
> In the above example output, there is a hidden column of `.Self` that indicates
|
||||||
|
|
@ -77,7 +78,7 @@ examples: |-
|
||||||
|
|
||||||
The `id` filter matches all or part of a node's id.
|
The `id` filter matches all or part of a node's id.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker node ls -f id=1
|
$ docker node ls -f id=1
|
||||||
|
|
||||||
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
||||||
|
|
@ -93,7 +94,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches nodes with the `foo` label regardless of its value.
|
The following filter matches nodes with the `foo` label regardless of its value.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker node ls -f "label=foo"
|
$ docker node ls -f "label=foo"
|
||||||
|
|
||||||
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
||||||
|
|
@ -143,7 +144,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches nodes with the `membership` of `accepted`.
|
The following filter matches nodes with the `membership` of `accepted`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker node ls -f "membership=accepted"
|
$ docker node ls -f "membership=accepted"
|
||||||
|
|
||||||
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
||||||
|
|
@ -157,7 +158,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches the nodes with a name equal to `swarm-master` string.
|
The following filter matches the nodes with a name equal to `swarm-master` string.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker node ls -f name=swarm-manager1
|
$ docker node ls -f name=swarm-manager1
|
||||||
|
|
||||||
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
||||||
|
|
@ -170,7 +171,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches nodes with the `manager` role.
|
The following filter matches nodes with the `manager` role.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker node ls -f "role=manager"
|
$ docker node ls -f "role=manager"
|
||||||
|
|
||||||
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
||||||
|
|
@ -203,8 +204,9 @@ examples: |-
|
||||||
`ID`, `Hostname`, and `TLS Status` entries separated by a colon (`:`) for all
|
`ID`, `Hostname`, and `TLS Status` entries separated by a colon (`:`) for all
|
||||||
nodes:
|
nodes:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker node ls --format "{{.ID}}: {{.Hostname}} {{.TLSStatus}}"
|
$ docker node ls --format "{{.ID}}: {{.Hostname}} {{.TLSStatus}}"
|
||||||
|
|
||||||
e216jshn25ckzbvmwlnh5jr3g: swarm-manager1 Ready
|
e216jshn25ckzbvmwlnh5jr3g: swarm-manager1 Ready
|
||||||
35o6tiywb700jesrt3dmllaza: swarm-worker1 Needs Rotation
|
35o6tiywb700jesrt3dmllaza: swarm-worker1 Needs Rotation
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ usage: docker node promote NODE [NODE...]
|
||||||
pname: docker node
|
pname: docker node
|
||||||
plink: docker_node.yaml
|
plink: docker_node.yaml
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker node promote <node name>
|
$ docker node promote <node name>
|
||||||
```
|
```
|
||||||
deprecated: false
|
deprecated: false
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,9 @@ options:
|
||||||
kubernetes: false
|
kubernetes: false
|
||||||
swarm: false
|
swarm: false
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker node ps swarm-manager1
|
$ docker node ps swarm-manager1
|
||||||
|
|
||||||
NAME IMAGE NODE DESIRED STATE CURRENT STATE
|
NAME IMAGE NODE DESIRED STATE CURRENT STATE
|
||||||
redis.1.7q92v0nr1hcgts2amcjyqg3pq redis:3.0.6 swarm-manager1 Running Running 5 hours
|
redis.1.7q92v0nr1hcgts2amcjyqg3pq redis:3.0.6 swarm-manager1 Running Running 5 hours
|
||||||
redis.6.b465edgho06e318egmgjbqo4o redis:3.0.6 swarm-manager1 Running Running 29 seconds
|
redis.6.b465edgho06e318egmgjbqo4o redis:3.0.6 swarm-manager1 Running Running 29 seconds
|
||||||
|
|
@ -89,7 +90,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches all tasks with a name containing the `redis` string.
|
The following filter matches all tasks with a name containing the `redis` string.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker node ps -f name=redis swarm-manager1
|
$ docker node ps -f name=redis swarm-manager1
|
||||||
|
|
||||||
NAME IMAGE NODE DESIRED STATE CURRENT STATE
|
NAME IMAGE NODE DESIRED STATE CURRENT STATE
|
||||||
|
|
@ -104,7 +105,7 @@ examples: |-
|
||||||
|
|
||||||
The `id` filter matches a task's id.
|
The `id` filter matches a task's id.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker node ps -f id=bg8c07zzg87di2mufeq51a2qp swarm-manager1
|
$ docker node ps -f id=bg8c07zzg87di2mufeq51a2qp swarm-manager1
|
||||||
|
|
||||||
NAME IMAGE NODE DESIRED STATE CURRENT STATE
|
NAME IMAGE NODE DESIRED STATE CURRENT STATE
|
||||||
|
|
@ -118,7 +119,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches tasks with the `usage` label regardless of its value.
|
The following filter matches tasks with the `usage` label regardless of its value.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker node ps -f "label=usage"
|
$ docker node ps -f "label=usage"
|
||||||
|
|
||||||
NAME IMAGE NODE DESIRED STATE CURRENT STATE
|
NAME IMAGE NODE DESIRED STATE CURRENT STATE
|
||||||
|
|
@ -157,8 +158,9 @@ examples: |-
|
||||||
The following example uses a template without headers and outputs the
|
The following example uses a template without headers and outputs the
|
||||||
`Name` and `Image` entries separated by a colon (`:`) for all tasks:
|
`Name` and `Image` entries separated by a colon (`:`) for all tasks:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker node ps --format "{{.Name}}: {{.Image}}"
|
$ docker node ps --format "{{.Name}}: {{.Image}}"
|
||||||
|
|
||||||
top.1: busybox
|
top.1: busybox
|
||||||
top.2: busybox
|
top.2: busybox
|
||||||
top.3: busybox
|
top.3: busybox
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,12 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### Remove a stopped node from the swarm
|
### Remove a stopped node from the swarm
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker node rm swarm-node-02
|
$ docker node rm swarm-node-02
|
||||||
|
|
||||||
Node swarm-node-02 removed from swarm
|
Node swarm-node-02 removed from swarm
|
||||||
```
|
```
|
||||||
|
|
||||||
### Attempt to remove a running node from a swarm
|
### Attempt to remove a running node from a swarm
|
||||||
|
|
||||||
Removes the specified nodes from the swarm, but only if the nodes are in the
|
Removes the specified nodes from the swarm, but only if the nodes are in the
|
||||||
|
|
@ -51,7 +52,7 @@ examples: |-
|
||||||
This may cause transient errors or interruptions, depending on the type of task
|
This may cause transient errors or interruptions, depending on the type of task
|
||||||
being run on the node.
|
being run on the node.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker node rm --force swarm-node-03
|
$ docker node rm --force swarm-node-03
|
||||||
|
|
||||||
Node swarm-node-03 removed from swarm
|
Node swarm-node-03 removed from swarm
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ examples: |-
|
||||||
|
|
||||||
To add multiple labels to a node, pass the `--label-add` flag for each label:
|
To add multiple labels to a node, pass the `--label-add` flag for each label:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker node update --label-add foo --label-add bar worker1
|
$ docker node update --label-add foo --label-add bar worker1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ usage: docker pause CONTAINER [CONTAINER...]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker pause my_container
|
$ docker pause my_container
|
||||||
```
|
```
|
||||||
deprecated: false
|
deprecated: false
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
The following example shows how to create a sample `plugin`.
|
The following example shows how to create a sample `plugin`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ ls -ls /home/pluginDir
|
$ ls -ls /home/pluginDir
|
||||||
|
|
||||||
total 4
|
total 4
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ examples: |-
|
||||||
The following example shows that the `sample-volume-plugin` plugin is installed
|
The following example shows that the `sample-volume-plugin` plugin is installed
|
||||||
and enabled:
|
and enabled:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker plugin ls
|
$ docker plugin ls
|
||||||
|
|
||||||
ID NAME DESCRIPTION ENABLED
|
ID NAME DESCRIPTION ENABLED
|
||||||
|
|
@ -31,7 +31,7 @@ examples: |-
|
||||||
|
|
||||||
To disable the plugin, use the following command:
|
To disable the plugin, use the following command:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker plugin disable tiborvass/sample-volume-plugin
|
$ docker plugin disable tiborvass/sample-volume-plugin
|
||||||
|
|
||||||
tiborvass/sample-volume-plugin
|
tiborvass/sample-volume-plugin
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ examples: |-
|
||||||
The following example shows that the `sample-volume-plugin` plugin is installed,
|
The following example shows that the `sample-volume-plugin` plugin is installed,
|
||||||
but disabled:
|
but disabled:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker plugin ls
|
$ docker plugin ls
|
||||||
|
|
||||||
ID NAME DESCRIPTION ENABLED
|
ID NAME DESCRIPTION ENABLED
|
||||||
|
|
@ -29,7 +29,7 @@ examples: |-
|
||||||
|
|
||||||
To enable the plugin, use the following command:
|
To enable the plugin, use the following command:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker plugin enable tiborvass/sample-volume-plugin
|
$ docker plugin enable tiborvass/sample-volume-plugin
|
||||||
|
|
||||||
tiborvass/sample-volume-plugin
|
tiborvass/sample-volume-plugin
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ examples: |-
|
||||||
|
|
||||||
The following example example inspects the `tiborvass/sample-volume-plugin` plugin:
|
The following example example inspects the `tiborvass/sample-volume-plugin` plugin:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker plugin inspect tiborvass/sample-volume-plugin:latest
|
$ docker plugin inspect tiborvass/sample-volume-plugin:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -138,7 +138,7 @@ examples: |-
|
||||||
|
|
||||||
### Formatting the output
|
### Formatting the output
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker plugin inspect -f '{{.Id}}' tiborvass/sample-volume-plugin:latest
|
$ docker plugin inspect -f '{{.Id}}' tiborvass/sample-volume-plugin:latest
|
||||||
|
|
||||||
8c74c978c434745c3ade82f1bc0acf38d04990eaf494fa507c16d9f1daa99c21
|
8c74c978c434745c3ade82f1bc0acf38d04990eaf494fa507c16d9f1daa99c21
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ examples: |-
|
||||||
Hub and prompt the user to accept the list of privileges that the plugin needs,
|
Hub and prompt the user to accept the list of privileges that the plugin needs,
|
||||||
set the plugin's parameters and enable the plugin.
|
set the plugin's parameters and enable the plugin.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker plugin install vieux/sshfs DEBUG=1
|
$ docker plugin install vieux/sshfs DEBUG=1
|
||||||
|
|
||||||
Plugin "vieux/sshfs" is requesting the following privileges:
|
Plugin "vieux/sshfs" is requesting the following privileges:
|
||||||
|
|
@ -63,7 +63,7 @@ examples: |-
|
||||||
|
|
||||||
After the plugin is installed, it appears in the list of plugins:
|
After the plugin is installed, it appears in the list of plugins:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker plugin ls
|
$ docker plugin ls
|
||||||
|
|
||||||
ID NAME DESCRIPTION ENABLED
|
ID NAME DESCRIPTION ENABLED
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ options:
|
||||||
kubernetes: false
|
kubernetes: false
|
||||||
swarm: false
|
swarm: false
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker plugin ls
|
$ docker plugin ls
|
||||||
|
|
||||||
ID NAME DESCRIPTION ENABLED
|
ID NAME DESCRIPTION ENABLED
|
||||||
|
|
@ -74,7 +74,7 @@ examples: |-
|
||||||
might have multiple capabilities. Currently `volumedriver`, `networkdriver`,
|
might have multiple capabilities. Currently `volumedriver`, `networkdriver`,
|
||||||
`ipamdriver`, `logdriver`, `metricscollector`, and `authz` are supported capabilities.
|
`ipamdriver`, `logdriver`, `metricscollector`, and `authz` are supported capabilities.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker plugin install --disable vieux/sshfs
|
$ docker plugin install --disable vieux/sshfs
|
||||||
|
|
||||||
Installed plugin vieux/sshfs
|
Installed plugin vieux/sshfs
|
||||||
|
|
@ -106,7 +106,7 @@ examples: |-
|
||||||
The following example uses a template without headers and outputs the
|
The following example uses a template without headers and outputs the
|
||||||
`ID` and `Name` entries separated by a colon (`:`) for all plugins:
|
`ID` and `Name` entries separated by a colon (`:`) for all plugins:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker plugin ls --format "{{.ID}}: {{.Name}}"
|
$ docker plugin ls --format "{{.ID}}: {{.Name}}"
|
||||||
|
|
||||||
4be01827a72e: vieux/sshfs:latest
|
4be01827a72e: vieux/sshfs:latest
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
The following example shows how to push a sample `user/plugin`.
|
The following example shows how to push a sample `user/plugin`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker plugin ls
|
$ docker plugin ls
|
||||||
|
|
||||||
ID NAME DESCRIPTION ENABLED
|
ID NAME DESCRIPTION ENABLED
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ examples: |-
|
||||||
The following example disables and removes the `sample-volume-plugin:latest`
|
The following example disables and removes the `sample-volume-plugin:latest`
|
||||||
plugin:
|
plugin:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker plugin disable tiborvass/sample-volume-plugin
|
$ docker plugin disable tiborvass/sample-volume-plugin
|
||||||
|
|
||||||
tiborvass/sample-volume-plugin
|
tiborvass/sample-volume-plugin
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ examples: |-
|
||||||
The following example change the env variable `DEBUG` on the
|
The following example change the env variable `DEBUG` on the
|
||||||
`sample-volume-plugin` plugin.
|
`sample-volume-plugin` plugin.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker plugin inspect -f {{.Settings.Env}} tiborvass/sample-volume-plugin
|
$ docker plugin inspect -f {{.Settings.Env}} tiborvass/sample-volume-plugin
|
||||||
[DEBUG=0]
|
[DEBUG=0]
|
||||||
|
|
||||||
|
|
@ -32,7 +32,7 @@ examples: |-
|
||||||
The following example change the source of the `mymount` mount on
|
The following example change the source of the `mymount` mount on
|
||||||
the `myplugin` plugin.
|
the `myplugin` plugin.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker plugin inspect -f '{{with $mount := index .Settings.Mounts 0}}{{$mount.Source}}{{end}}' myplugin
|
$ docker plugin inspect -f '{{with $mount := index .Settings.Mounts 0}}{{$mount.Source}}{{end}}' myplugin
|
||||||
/foo
|
/foo
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@ examples: |-
|
||||||
The following example change the path of the `mydevice` device on
|
The following example change the path of the `mydevice` device on
|
||||||
the `myplugin` plugin.
|
the `myplugin` plugin.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker plugin inspect -f '{{with $device := index .Settings.Devices 0}}{{$device.Path}}{{end}}' myplugin
|
$ docker plugin inspect -f '{{with $device := index .Settings.Devices 0}}{{$device.Path}}{{end}}' myplugin
|
||||||
|
|
||||||
/dev/foo
|
/dev/foo
|
||||||
|
|
@ -72,7 +72,7 @@ examples: |-
|
||||||
|
|
||||||
The following example change the value of the args on the `myplugin` plugin.
|
The following example change the value of the args on the `myplugin` plugin.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker plugin inspect -f '{{.Settings.Args}}' myplugin
|
$ docker plugin inspect -f '{{.Settings.Args}}' myplugin
|
||||||
|
|
||||||
["foo", "bar"]
|
["foo", "bar"]
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ examples: |-
|
||||||
The following example installs `vieus/sshfs` plugin, uses it to create and use
|
The following example installs `vieus/sshfs` plugin, uses it to create and use
|
||||||
a volume, then upgrades the plugin.
|
a volume, then upgrades the plugin.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker plugin install vieux/sshfs DEBUG=1
|
$ docker plugin install vieux/sshfs DEBUG=1
|
||||||
|
|
||||||
Plugin "vieux/sshfs:next" is requesting the following privileges:
|
Plugin "vieux/sshfs:next" is requesting the following privileges:
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ examples: |-
|
||||||
You can find out all the ports mapped by not specifying a `PRIVATE_PORT`, or
|
You can find out all the ports mapped by not specifying a `PRIVATE_PORT`, or
|
||||||
just a specific mapping:
|
just a specific mapping:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps
|
$ docker ps
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ examples: |-
|
||||||
|
|
||||||
Running `docker ps --no-trunc` showing 2 linked containers.
|
Running `docker ps --no-trunc` showing 2 linked containers.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps
|
$ docker ps
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -99,7 +99,7 @@ examples: |-
|
||||||
The `docker ps` command only shows running containers by default. To see all
|
The `docker ps` command only shows running containers by default. To see all
|
||||||
containers, use the `-a` (or `--all`) flag:
|
containers, use the `-a` (or `--all`) flag:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps -a
|
$ docker ps -a
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -111,7 +111,7 @@ examples: |-
|
||||||
|
|
||||||
The `docker ps -s` command displays two different on-disk-sizes for each container:
|
The `docker ps -s` command displays two different on-disk-sizes for each container:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps -s
|
$ docker ps -s
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES SIZE SIZE
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES SIZE SIZE
|
||||||
|
|
@ -155,7 +155,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches containers with the `color` label regardless of its value.
|
The following filter matches containers with the `color` label regardless of its value.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps --filter "label=color"
|
$ docker ps --filter "label=color"
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -165,7 +165,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches containers with the `color` label with the `blue` value.
|
The following filter matches containers with the `color` label with the `blue` value.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps --filter "label=color=blue"
|
$ docker ps --filter "label=color=blue"
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -178,7 +178,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches all containers with a name containing the `nostalgic_stallman` string.
|
The following filter matches all containers with a name containing the `nostalgic_stallman` string.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps --filter "name=nostalgic_stallman"
|
$ docker ps --filter "name=nostalgic_stallman"
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -187,7 +187,7 @@ examples: |-
|
||||||
|
|
||||||
You can also filter for a substring in a name as this shows:
|
You can also filter for a substring in a name as this shows:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps --filter "name=nostalgic"
|
$ docker ps --filter "name=nostalgic"
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -201,7 +201,7 @@ examples: |-
|
||||||
The `exited` filter matches containers by exist status code. For example, to
|
The `exited` filter matches containers by exist status code. For example, to
|
||||||
filter for containers that have exited successfully:
|
filter for containers that have exited successfully:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps -a --filter 'exited=0'
|
$ docker ps -a --filter 'exited=0'
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -215,7 +215,7 @@ examples: |-
|
||||||
You can use a filter to locate containers that exited with status of `137`
|
You can use a filter to locate containers that exited with status of `137`
|
||||||
meaning a `SIGKILL(9)` killed them.
|
meaning a `SIGKILL(9)` killed them.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps -a --filter 'exited=137'
|
$ docker ps -a --filter 'exited=137'
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -235,7 +235,7 @@ examples: |-
|
||||||
`created`, `restarting`, `running`, `removing`, `paused`, `exited` and `dead`. For example,
|
`created`, `restarting`, `running`, `removing`, `paused`, `exited` and `dead`. For example,
|
||||||
to filter for `running` containers:
|
to filter for `running` containers:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps --filter status=running
|
$ docker ps --filter status=running
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -246,7 +246,7 @@ examples: |-
|
||||||
|
|
||||||
To filter for `paused` containers:
|
To filter for `paused` containers:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps --filter status=paused
|
$ docker ps --filter status=paused
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -267,7 +267,7 @@ examples: |-
|
||||||
If you don't specify a `tag`, the `latest` tag is used. For example, to filter
|
If you don't specify a `tag`, the `latest` tag is used. For example, to filter
|
||||||
for containers that use the latest `ubuntu` image:
|
for containers that use the latest `ubuntu` image:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps --filter ancestor=ubuntu
|
$ docker ps --filter ancestor=ubuntu
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -280,7 +280,7 @@ examples: |-
|
||||||
Match containers based on the `ubuntu-c1` image which, in this case, is a child
|
Match containers based on the `ubuntu-c1` image which, in this case, is a child
|
||||||
of `ubuntu`:
|
of `ubuntu`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps --filter ancestor=ubuntu-c1
|
$ docker ps --filter ancestor=ubuntu-c1
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -289,7 +289,7 @@ examples: |-
|
||||||
|
|
||||||
Match containers based on the `ubuntu` version `12.04.5` image:
|
Match containers based on the `ubuntu` version `12.04.5` image:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps --filter ancestor=ubuntu:12.04.5
|
$ docker ps --filter ancestor=ubuntu:12.04.5
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -299,7 +299,7 @@ examples: |-
|
||||||
The following matches containers based on the layer `d0e008c6cf02` or an image
|
The following matches containers based on the layer `d0e008c6cf02` or an image
|
||||||
that have this layer in its layer stack.
|
that have this layer in its layer stack.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps --filter ancestor=d0e008c6cf02
|
$ docker ps --filter ancestor=d0e008c6cf02
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -313,7 +313,7 @@ examples: |-
|
||||||
The `before` filter shows only containers created before the container with
|
The `before` filter shows only containers created before the container with
|
||||||
given id or name. For example, having these containers created:
|
given id or name. For example, having these containers created:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps
|
$ docker ps
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -324,7 +324,7 @@ examples: |-
|
||||||
|
|
||||||
Filtering with `before` would give:
|
Filtering with `before` would give:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps -f before=9c3527ed70ce
|
$ docker ps -f before=9c3527ed70ce
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -337,7 +337,7 @@ examples: |-
|
||||||
The `since` filter shows only containers created since the container with given
|
The `since` filter shows only containers created since the container with given
|
||||||
id or name. For example, with the same containers as in `before` filter:
|
id or name. For example, with the same containers as in `before` filter:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps -f since=6e63f6ff38b0
|
$ docker ps -f since=6e63f6ff38b0
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -350,7 +350,7 @@ examples: |-
|
||||||
The `volume` filter shows only containers that mount a specific volume or have
|
The `volume` filter shows only containers that mount a specific volume or have
|
||||||
a volume mounted in a specific path:
|
a volume mounted in a specific path:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps --filter volume=remote-volume --format "table {{.ID}}\t{{.Mounts}}"
|
$ docker ps --filter volume=remote-volume --format "table {{.ID}}\t{{.Mounts}}"
|
||||||
|
|
||||||
CONTAINER ID MOUNTS
|
CONTAINER ID MOUNTS
|
||||||
|
|
@ -370,7 +370,7 @@ examples: |-
|
||||||
The following filter matches all containers that are connected to a network
|
The following filter matches all containers that are connected to a network
|
||||||
with a name containing `net1`.
|
with a name containing `net1`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d --net=net1 --name=test1 ubuntu top
|
$ docker run -d --net=net1 --name=test1 ubuntu top
|
||||||
$ docker run -d --net=net2 --name=test2 ubuntu top
|
$ docker run -d --net=net2 --name=test2 ubuntu top
|
||||||
|
|
||||||
|
|
@ -384,7 +384,7 @@ examples: |-
|
||||||
example shows all containers that are attached to the `net1` network, using
|
example shows all containers that are attached to the `net1` network, using
|
||||||
the network id as a filter;
|
the network id as a filter;
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network inspect --format "{{.ID}}" net1
|
$ docker network inspect --format "{{.ID}}" net1
|
||||||
|
|
||||||
8c0b4110ae930dbe26b258de9bc34a03f98056ed6f27f991d32919bfe401d7c5
|
8c0b4110ae930dbe26b258de9bc34a03f98056ed6f27f991d32919bfe401d7c5
|
||||||
|
|
@ -402,7 +402,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches all containers that have published port of 80:
|
The following filter matches all containers that have published port of 80:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d --publish=80 busybox top
|
$ docker run -d --publish=80 busybox top
|
||||||
$ docker run -d --expose=8080 busybox top
|
$ docker run -d --expose=8080 busybox top
|
||||||
|
|
||||||
|
|
@ -419,7 +419,8 @@ examples: |-
|
||||||
```
|
```
|
||||||
|
|
||||||
The following filter matches all containers that have exposed TCP port in the range of `8000-8080`:
|
The following filter matches all containers that have exposed TCP port in the range of `8000-8080`:
|
||||||
```bash
|
|
||||||
|
```console
|
||||||
$ docker ps --filter expose=8000-8080/tcp
|
$ docker ps --filter expose=8000-8080/tcp
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -427,7 +428,8 @@ examples: |-
|
||||||
```
|
```
|
||||||
|
|
||||||
The following filter matches all containers that have exposed UDP port `80`:
|
The following filter matches all containers that have exposed UDP port `80`:
|
||||||
```bash
|
|
||||||
|
```console
|
||||||
$ docker ps --filter publish=80/udp
|
$ docker ps --filter publish=80/udp
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
|
@ -464,7 +466,7 @@ examples: |-
|
||||||
The following example uses a template without headers and outputs the `ID` and
|
The following example uses a template without headers and outputs the `ID` and
|
||||||
`Command` entries separated by a colon (`:`) for all running containers:
|
`Command` entries separated by a colon (`:`) for all running containers:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps --format "{{.ID}}: {{.Command}}"
|
$ docker ps --format "{{.ID}}: {{.Command}}"
|
||||||
|
|
||||||
a87ecb4f327c: /bin/sh -c #(nop) MA
|
a87ecb4f327c: /bin/sh -c #(nop) MA
|
||||||
|
|
@ -475,7 +477,7 @@ examples: |-
|
||||||
|
|
||||||
To list all running containers with their labels in a table format you can use:
|
To list all running containers with their labels in a table format you can use:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker ps --format "table {{.ID}}\t{{.Labels}}"
|
$ docker ps --format "table {{.ID}}\t{{.Labels}}"
|
||||||
|
|
||||||
CONTAINER ID LABELS
|
CONTAINER ID LABELS
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ examples: |-
|
||||||
`docker pull`. If no tag is provided, Docker Engine uses the `:latest` tag as a
|
`docker pull`. If no tag is provided, Docker Engine uses the `:latest` tag as a
|
||||||
default. This command pulls the `debian:latest` image:
|
default. This command pulls the `debian:latest` image:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker pull debian
|
$ docker pull debian
|
||||||
|
|
||||||
Using default tag: latest
|
Using default tag: latest
|
||||||
|
|
@ -93,7 +93,7 @@ examples: |-
|
||||||
only pulls its metadata, but not its layers, because all layers are already
|
only pulls its metadata, but not its layers, because all layers are already
|
||||||
present locally:
|
present locally:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker pull debian:jessie
|
$ docker pull debian:jessie
|
||||||
|
|
||||||
jessie: Pulling from library/debian
|
jessie: Pulling from library/debian
|
||||||
|
|
@ -106,7 +106,7 @@ examples: |-
|
||||||
To see which images are present locally, use the [`docker images`](images.md)
|
To see which images are present locally, use the [`docker images`](images.md)
|
||||||
command:
|
command:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images
|
$ docker images
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -142,22 +142,22 @@ examples: |-
|
||||||
To know the digest of an image, pull the image first. Let's pull the latest
|
To know the digest of an image, pull the image first. Let's pull the latest
|
||||||
`ubuntu:14.04` image from Docker Hub:
|
`ubuntu:14.04` image from Docker Hub:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker pull ubuntu:14.04
|
$ docker pull ubuntu:20.04
|
||||||
|
|
||||||
14.04: Pulling from library/ubuntu
|
20.04: Pulling from library/ubuntu
|
||||||
5a132a7e7af1: Pull complete
|
16ec32c2132b: Pull complete
|
||||||
fd2731e4c50c: Pull complete
|
Digest: sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
|
||||||
28a2f68d1120: Pull complete
|
Status: Downloaded newer image for ubuntu:20.04
|
||||||
a3ed95caeb02: Pull complete
|
docker.io/library/ubuntu:20.04
|
||||||
Digest: sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
|
|
||||||
Status: Downloaded newer image for ubuntu:14.04
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Docker prints the digest of the image after the pull has finished. In the example
|
Docker prints the digest of the image after the pull has finished. In the example
|
||||||
above, the digest of the image is:
|
above, the digest of the image is:
|
||||||
|
|
||||||
sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
|
```console
|
||||||
|
sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
|
||||||
|
```
|
||||||
|
|
||||||
Docker also prints the digest of an image when *pushing* to a registry. This
|
Docker also prints the digest of an image when *pushing* to a registry. This
|
||||||
may be useful if you want to pin to a version of the image you just pushed.
|
may be useful if you want to pin to a version of the image you just pushed.
|
||||||
|
|
@ -165,22 +165,19 @@ examples: |-
|
||||||
A digest takes the place of the tag when pulling an image, for example, to
|
A digest takes the place of the tag when pulling an image, for example, to
|
||||||
pull the above image by digest, run the following command:
|
pull the above image by digest, run the following command:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker pull ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
|
$ docker pull ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
|
||||||
|
|
||||||
sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2: Pulling from library/ubuntu
|
docker.io/library/ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3: Pulling from library/ubuntu
|
||||||
5a132a7e7af1: Already exists
|
Digest: sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
|
||||||
fd2731e4c50c: Already exists
|
Status: Image is up to date for ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
|
||||||
28a2f68d1120: Already exists
|
docker.io/library/ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
|
||||||
a3ed95caeb02: Already exists
|
|
||||||
Digest: sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
|
|
||||||
Status: Downloaded newer image for ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Digest can also be used in the `FROM` of a Dockerfile, for example:
|
Digest can also be used in the `FROM` of a Dockerfile, for example:
|
||||||
|
|
||||||
```dockerfile
|
```dockerfile
|
||||||
FROM ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
|
FROM ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
|
||||||
LABEL org.opencontainers.image.authors="some maintainer <maintainer@example.com>"
|
LABEL org.opencontainers.image.authors="some maintainer <maintainer@example.com>"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -202,7 +199,7 @@ examples: |-
|
||||||
The following command pulls the `testing/test-image` image from a local registry
|
The following command pulls the `testing/test-image` image from a local registry
|
||||||
listening on port 5000 (`myregistry.local:5000`):
|
listening on port 5000 (`myregistry.local:5000`):
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker pull myregistry.local:5000/testing/test-image
|
$ docker pull myregistry.local:5000/testing/test-image
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -221,7 +218,7 @@ examples: |-
|
||||||
|
|
||||||
This command pulls all images from the `fedora` repository:
|
This command pulls all images from the `fedora` repository:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker pull --all-tags fedora
|
$ docker pull --all-tags fedora
|
||||||
|
|
||||||
Pulling repository fedora
|
Pulling repository fedora
|
||||||
|
|
@ -238,7 +235,7 @@ examples: |-
|
||||||
images that were pulled. The example below shows all the `fedora` images
|
images that were pulled. The example below shows all the `fedora` images
|
||||||
that are present locally:
|
that are present locally:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images fedora
|
$ docker images fedora
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -253,7 +250,7 @@ examples: |-
|
||||||
Killing the `docker pull` process, for example by pressing `CTRL-c` while it is
|
Killing the `docker pull` process, for example by pressing `CTRL-c` while it is
|
||||||
running in a terminal, will terminate the pull operation.
|
running in a terminal, will terminate the pull operation.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker pull fedora
|
$ docker pull fedora
|
||||||
|
|
||||||
Using default tag: latest
|
Using default tag: latest
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ examples: |-
|
||||||
and then committing it to a new image name. Note that only `a-z0-9-_.` are
|
and then committing it to a new image name. Note that only `a-z0-9-_.` are
|
||||||
allowed when naming images:
|
allowed when naming images:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker container commit c16378f943fe rhel-httpd:latest
|
$ docker container commit c16378f943fe rhel-httpd:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@ examples: |-
|
||||||
this, tag the image with the host name or IP address, and the port of the
|
this, tag the image with the host name or IP address, and the port of the
|
||||||
registry:
|
registry:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker image tag rhel-httpd:latest registry-host:5000/myadmin/rhel-httpd:latest
|
$ docker image tag rhel-httpd:latest registry-host:5000/myadmin/rhel-httpd:latest
|
||||||
|
|
||||||
$ docker image push registry-host:5000/myadmin/rhel-httpd:latest
|
$ docker image push registry-host:5000/myadmin/rhel-httpd:latest
|
||||||
|
|
@ -79,7 +79,7 @@ examples: |-
|
||||||
|
|
||||||
Check that this worked by running:
|
Check that this worked by running:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker image ls
|
$ docker image ls
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -94,7 +94,7 @@ examples: |-
|
||||||
tags to Docker Hub.
|
tags to Docker Hub.
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker image tag myimage registry-host:5000/myname/myimage:latest
|
$ docker image tag myimage registry-host:5000/myname/myimage:latest
|
||||||
$ docker image tag myimage registry-host:5000/myname/myimage:v1.0.1
|
$ docker image tag myimage registry-host:5000/myname/myimage:v1.0.1
|
||||||
$ docker image tag myimage registry-host:5000/myname/myimage:v1.0
|
$ docker image tag myimage registry-host:5000/myname/myimage:v1.0
|
||||||
|
|
@ -103,7 +103,7 @@ examples: |-
|
||||||
|
|
||||||
The image is now tagged under multiple names:
|
The image is now tagged under multiple names:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker image ls
|
$ docker image ls
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -118,7 +118,7 @@ examples: |-
|
||||||
image are pushed:
|
image are pushed:
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker image push --all-tags registry-host:5000/myname/myimage
|
$ docker image push --all-tags registry-host:5000/myname/myimage
|
||||||
|
|
||||||
The push refers to repository [registry-host:5000/myname/myimage]
|
The push refers to repository [registry-host:5000/myname/myimage]
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ usage: docker rename CONTAINER NEW_NAME
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker rename my_container my_new_container
|
$ docker rename my_container my_new_container
|
||||||
```
|
```
|
||||||
deprecated: false
|
deprecated: false
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ options:
|
||||||
kubernetes: false
|
kubernetes: false
|
||||||
swarm: false
|
swarm: false
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker restart my_container
|
$ docker restart my_container
|
||||||
```
|
```
|
||||||
deprecated: false
|
deprecated: false
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ examples: |-
|
||||||
|
|
||||||
This removes the container referenced under the link `/redis`.
|
This removes the container referenced under the link `/redis`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker rm /redis
|
$ docker rm /redis
|
||||||
|
|
||||||
/redis
|
/redis
|
||||||
|
|
@ -53,7 +53,7 @@ examples: |-
|
||||||
between the two containers. This does not apply when `--link` is used with
|
between the two containers. This does not apply when `--link` is used with
|
||||||
user-specified networks.
|
user-specified networks.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker rm --link /webapp/redis
|
$ docker rm --link /webapp/redis
|
||||||
|
|
||||||
/webapp/redis
|
/webapp/redis
|
||||||
|
|
@ -63,7 +63,7 @@ examples: |-
|
||||||
|
|
||||||
This command force-removes a running container.
|
This command force-removes a running container.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker rm --force redis
|
$ docker rm --force redis
|
||||||
|
|
||||||
redis
|
redis
|
||||||
|
|
@ -104,7 +104,7 @@ examples: |-
|
||||||
|
|
||||||
### Remove a container and its volumes
|
### Remove a container and its volumes
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker rm -v redis
|
$ docker rm -v redis
|
||||||
redis
|
redis
|
||||||
```
|
```
|
||||||
|
|
@ -114,7 +114,7 @@ examples: |-
|
||||||
|
|
||||||
### Remove a container and selectively remove volumes
|
### Remove a container and selectively remove volumes
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker create -v awesome:/foo -v /bar --name hello redis
|
$ docker create -v awesome:/foo -v /bar --name hello redis
|
||||||
hello
|
hello
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ examples: |-
|
||||||
the image is removed. Digest references are removed automatically when an image
|
the image is removed. Digest references are removed automatically when an image
|
||||||
is removed by tag.
|
is removed by tag.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images
|
$ docker images
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -74,7 +74,7 @@ examples: |-
|
||||||
If you use the `-f` flag and specify the image's short or long ID, then this
|
If you use the `-f` flag and specify the image's short or long ID, then this
|
||||||
command untags and removes all images that match the specified ID.
|
command untags and removes all images that match the specified ID.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images
|
$ docker images
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
@ -92,7 +92,7 @@ examples: |-
|
||||||
|
|
||||||
An image pulled by digest has no tag associated with it:
|
An image pulled by digest has no tag associated with it:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker images --digests
|
$ docker images --digests
|
||||||
|
|
||||||
REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE
|
REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE
|
||||||
|
|
@ -101,7 +101,7 @@ examples: |-
|
||||||
|
|
||||||
To remove an image using its digest:
|
To remove an image using its digest:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker rmi localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf
|
$ docker rmi localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf
|
||||||
Untagged: localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf
|
Untagged: localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf
|
||||||
Deleted: 4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125
|
Deleted: 4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125
|
||||||
|
|
|
||||||
|
|
@ -927,7 +927,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### Assign name and allocate pseudo-TTY (--name, -it)
|
### Assign name and allocate pseudo-TTY (--name, -it)
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run --name test -it debian
|
$ docker run --name test -it debian
|
||||||
|
|
||||||
root@d6c0fe130dba:/# exit 13
|
root@d6c0fe130dba:/# exit 13
|
||||||
|
|
@ -946,7 +946,7 @@ examples: |-
|
||||||
|
|
||||||
### Capture container ID (--cidfile)
|
### Capture container ID (--cidfile)
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run --cidfile /tmp/docker_test.cid ubuntu echo "test"
|
$ docker run --cidfile /tmp/docker_test.cid ubuntu echo "test"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -957,7 +957,7 @@ examples: |-
|
||||||
|
|
||||||
### Full container capabilities (--privileged)
|
### Full container capabilities (--privileged)
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -t -i --rm ubuntu bash
|
$ docker run -t -i --rm ubuntu bash
|
||||||
root@bc338942ef20:/# mount -t tmpfs none /mnt
|
root@bc338942ef20:/# mount -t tmpfs none /mnt
|
||||||
mount: permission denied
|
mount: permission denied
|
||||||
|
|
@ -967,7 +967,7 @@ examples: |-
|
||||||
capabilities are dropped; including `cap_sys_admin` (which is required to mount
|
capabilities are dropped; including `cap_sys_admin` (which is required to mount
|
||||||
filesystems). However, the `--privileged` flag will allow it to run:
|
filesystems). However, the `--privileged` flag will allow it to run:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -t -i --privileged ubuntu bash
|
$ docker run -t -i --privileged ubuntu bash
|
||||||
root@50e3f57e16e6:/# mount -t tmpfs none /mnt
|
root@50e3f57e16e6:/# mount -t tmpfs none /mnt
|
||||||
root@50e3f57e16e6:/# df -h
|
root@50e3f57e16e6:/# df -h
|
||||||
|
|
@ -982,7 +982,7 @@ examples: |-
|
||||||
|
|
||||||
### Set working directory (-w)
|
### Set working directory (-w)
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -w /path/to/dir/ -i -t ubuntu pwd
|
$ docker run -w /path/to/dir/ -i -t ubuntu pwd
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -991,7 +991,7 @@ examples: |-
|
||||||
|
|
||||||
### Set storage driver options per container
|
### Set storage driver options per container
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -it --storage-opt size=120G fedora /bin/bash
|
$ docker run -it --storage-opt size=120G fedora /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1006,7 +1006,7 @@ examples: |-
|
||||||
|
|
||||||
### Mount tmpfs (--tmpfs)
|
### Mount tmpfs (--tmpfs)
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d --tmpfs /run:rw,noexec,nosuid,size=65536k my_image
|
$ docker run -d --tmpfs /run:rw,noexec,nosuid,size=65536k my_image
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1015,7 +1015,7 @@ examples: |-
|
||||||
|
|
||||||
### Mount volume (-v, --read-only)
|
### Mount volume (-v, --read-only)
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -v `pwd`:`pwd` -w `pwd` -i -t ubuntu pwd
|
$ docker run -v `pwd`:`pwd` -w `pwd` -i -t ubuntu pwd
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1025,7 +1025,7 @@ examples: |-
|
||||||
combination executes the command using the container, but inside the
|
combination executes the command using the container, but inside the
|
||||||
current working directory.
|
current working directory.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -v /doesnt/exist:/foo -w /foo -i -t ubuntu bash
|
$ docker run -v /doesnt/exist:/foo -w /foo -i -t ubuntu bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1034,7 +1034,7 @@ examples: |-
|
||||||
example above, Docker will create the `/doesnt/exist`
|
example above, Docker will create the `/doesnt/exist`
|
||||||
folder before starting your container.
|
folder before starting your container.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run --read-only -v /icanwrite busybox touch /icanwrite/here
|
$ docker run --read-only -v /icanwrite busybox touch /icanwrite/here
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1043,7 +1043,7 @@ examples: |-
|
||||||
filesystem as read only prohibiting writes to locations other than the
|
filesystem as read only prohibiting writes to locations other than the
|
||||||
specified volumes for the container.
|
specified volumes for the container.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -t -i -v /var/run/docker.sock:/var/run/docker.sock -v /path/to/static-docker-binary:/usr/bin/docker busybox sh
|
$ docker run -t -i -v /var/run/docker.sock:/var/run/docker.sock -v /path/to/static-docker-binary:/usr/bin/docker busybox sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1093,17 +1093,17 @@ examples: |-
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run --read-only --mount type=volume,target=/icanwrite busybox touch /icanwrite/here
|
$ docker run --read-only --mount type=volume,target=/icanwrite busybox touch /icanwrite/here
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -t -i --mount type=bind,src=/data,dst=/data busybox sh
|
$ docker run -t -i --mount type=bind,src=/data,dst=/data busybox sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### Publish or expose port (-p, --expose)
|
### Publish or expose port (-p, --expose)
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -p 127.0.0.1:80:8080/tcp ubuntu bash
|
$ docker run -p 127.0.0.1:80:8080/tcp ubuntu bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1117,7 +1117,7 @@ examples: |-
|
||||||
you configured UFW to block this specific port, as Docker manages his
|
you configured UFW to block this specific port, as Docker manages his
|
||||||
own iptables rules. [Read more](https://docs.docker.com/network/iptables/)
|
own iptables rules. [Read more](https://docs.docker.com/network/iptables/)
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run --expose 80 ubuntu bash
|
$ docker run --expose 80 ubuntu bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1126,7 +1126,7 @@ examples: |-
|
||||||
|
|
||||||
### Set environment variables (-e, --env, --env-file)
|
### Set environment variables (-e, --env, --env-file)
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -e MYVAR1 --env MYVAR2=foo --env-file ./env.list ubuntu bash
|
$ docker run -e MYVAR1 --env MYVAR2=foo --env-file ./env.list ubuntu bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1136,7 +1136,7 @@ examples: |-
|
||||||
|
|
||||||
You can define the variable and its value when running the container:
|
You can define the variable and its value when running the container:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run --env VAR1=value1 --env VAR2=value2 ubuntu env | grep VAR
|
$ docker run --env VAR1=value1 --env VAR2=value2 ubuntu env | grep VAR
|
||||||
VAR1=value1
|
VAR1=value1
|
||||||
VAR2=value2
|
VAR2=value2
|
||||||
|
|
@ -1144,7 +1144,7 @@ examples: |-
|
||||||
|
|
||||||
You can also use variables that you've exported to your local environment:
|
You can also use variables that you've exported to your local environment:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
export VAR1=value1
|
export VAR1=value1
|
||||||
export VAR2=value2
|
export VAR2=value2
|
||||||
|
|
||||||
|
|
@ -1162,7 +1162,7 @@ examples: |-
|
||||||
the syntax `<variable>=value` (which sets the variable to the given value) or
|
the syntax `<variable>=value` (which sets the variable to the given value) or
|
||||||
`<variable>` (which takes the value from the local environment), and `#` for comments.
|
`<variable>` (which takes the value from the local environment), and `#` for comments.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ cat env.list
|
$ cat env.list
|
||||||
# This is a comment
|
# This is a comment
|
||||||
VAR1=value1
|
VAR1=value1
|
||||||
|
|
@ -1179,7 +1179,7 @@ examples: |-
|
||||||
|
|
||||||
A label is a `key=value` pair that applies metadata to a container. To label a container with two labels:
|
A label is a `key=value` pair that applies metadata to a container. To label a container with two labels:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -l my-label --label com.example.foo=bar ubuntu bash
|
$ docker run -l my-label --label com.example.foo=bar ubuntu bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1194,7 +1194,7 @@ examples: |-
|
||||||
label in the file with an EOL mark. The example below loads labels from a
|
label in the file with an EOL mark. The example below loads labels from a
|
||||||
labels file in the current directory:
|
labels file in the current directory:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run --label-file ./labels ubuntu bash
|
$ docker run --label-file ./labels ubuntu bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1222,14 +1222,14 @@ examples: |-
|
||||||
When you start a container use the `--network` flag to connect it to a network.
|
When you start a container use the `--network` flag to connect it to a network.
|
||||||
This adds the `busybox` container to the `my-net` network.
|
This adds the `busybox` container to the `my-net` network.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -itd --network=my-net busybox
|
$ docker run -itd --network=my-net busybox
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also choose the IP addresses for the container with `--ip` and `--ip6`
|
You can also choose the IP addresses for the container with `--ip` and `--ip6`
|
||||||
flags when you start the container on a user-defined network.
|
flags when you start the container on a user-defined network.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -itd --network=my-net --ip=10.10.9.75 busybox
|
$ docker run -itd --network=my-net --ip=10.10.9.75 busybox
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1252,7 +1252,7 @@ examples: |-
|
||||||
|
|
||||||
### Mount volumes from container (--volumes-from)
|
### Mount volumes from container (--volumes-from)
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run --volumes-from 777f7dc92da7 --volumes-from ba8c0c54f0f2:ro -i -t ubuntu pwd
|
$ docker run --volumes-from 777f7dc92da7 --volumes-from ba8c0c54f0f2:ro -i -t ubuntu pwd
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1282,14 +1282,14 @@ examples: |-
|
||||||
or `STDERR`. This makes it possible to manipulate the output and input as
|
or `STDERR`. This makes it possible to manipulate the output and input as
|
||||||
needed.
|
needed.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ echo "test" | docker run -i -a stdin ubuntu cat -
|
$ echo "test" | docker run -i -a stdin ubuntu cat -
|
||||||
```
|
```
|
||||||
|
|
||||||
This pipes data into a container and prints the container's ID by attaching
|
This pipes data into a container and prints the container's ID by attaching
|
||||||
only to the container's `STDIN`.
|
only to the container's `STDIN`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -a stderr ubuntu echo test
|
$ docker run -a stderr ubuntu echo test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1297,7 +1297,7 @@ examples: |-
|
||||||
only attached to the `STDERR` of the container. The container's logs
|
only attached to the `STDERR` of the container. The container's logs
|
||||||
still store what's been written to `STDERR` and `STDOUT`.
|
still store what's been written to `STDERR` and `STDOUT`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ cat somefile | docker run -i -a stdin mybuilder dobuild
|
$ cat somefile | docker run -i -a stdin mybuilder dobuild
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1309,7 +1309,7 @@ examples: |-
|
||||||
|
|
||||||
### Add host device to container (--device)
|
### Add host device to container (--device)
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run --device=/dev/sdc:/dev/xvdc \
|
$ docker run --device=/dev/sdc:/dev/xvdc \
|
||||||
--device=/dev/sdd --device=/dev/zero:/dev/nulo \
|
--device=/dev/sdd --device=/dev/zero:/dev/nulo \
|
||||||
-i -t \
|
-i -t \
|
||||||
|
|
@ -1330,7 +1330,7 @@ examples: |-
|
||||||
flag. If the container is running in privileged mode, then the permissions specified
|
flag. If the container is running in privileged mode, then the permissions specified
|
||||||
will be ignored.
|
will be ignored.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run --device=/dev/sda:/dev/xvdc --rm -it ubuntu fdisk /dev/xvdc
|
$ docker run --device=/dev/sda:/dev/xvdc --rm -it ubuntu fdisk /dev/xvdc
|
||||||
|
|
||||||
Command (m for help): q
|
Command (m for help): q
|
||||||
|
|
@ -1386,20 +1386,20 @@ examples: |-
|
||||||
To use `--gpus`, specify which GPUs (or all) to use. If no value is provied, all
|
To use `--gpus`, specify which GPUs (or all) to use. If no value is provied, all
|
||||||
available GPUs are used. The example below exposes all available GPUs.
|
available GPUs are used. The example below exposes all available GPUs.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -it --rm --gpus all ubuntu nvidia-smi
|
$ docker run -it --rm --gpus all ubuntu nvidia-smi
|
||||||
```
|
```
|
||||||
|
|
||||||
Use the `device` option to specify GPUs. The example below exposes a specific
|
Use the `device` option to specify GPUs. The example below exposes a specific
|
||||||
GPU.
|
GPU.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -it --rm --gpus device=GPU-3a23c669-1f69-c64e-cf85-44e9b07e7a2a ubuntu nvidia-smi
|
$ docker run -it --rm --gpus device=GPU-3a23c669-1f69-c64e-cf85-44e9b07e7a2a ubuntu nvidia-smi
|
||||||
```
|
```
|
||||||
|
|
||||||
The example below exposes the first and third GPUs.
|
The example below exposes the first and third GPUs.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -it --rm --gpus device=0,2 nvidia-smi
|
$ docker run -it --rm --gpus device=0,2 nvidia-smi
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1416,7 +1416,7 @@ examples: |-
|
||||||
| `unless-stopped` | Restart the container unless it is explicitly stopped or Docker itself is stopped or restarted. |
|
| `unless-stopped` | Restart the container unless it is explicitly stopped or Docker itself is stopped or restarted. |
|
||||||
| `always` | Always restart the container regardless of the exit status. When you specify always, the Docker daemon will try to restart the container indefinitely. The container will also always start on daemon startup, regardless of the current state of the container. |
|
| `always` | Always restart the container regardless of the exit status. When you specify always, the Docker daemon will try to restart the container indefinitely. The container will also always start on daemon startup, regardless of the current state of the container. |
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run --restart=always redis
|
$ docker run --restart=always redis
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1433,16 +1433,18 @@ examples: |-
|
||||||
more `--add-host` flags. This example adds a static address for a host named
|
more `--add-host` flags. This example adds a static address for a host named
|
||||||
`docker`:
|
`docker`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run --add-host=docker:10.180.0.1 --rm -it debian
|
$ docker run --add-host=docker:93.184.216.34 --rm -it alpine
|
||||||
|
|
||||||
root@f38c87f2a42d:/# ping docker
|
/ # ping docker
|
||||||
PING docker (10.180.0.1): 48 data bytes
|
PING docker (93.184.216.34): 56 data bytes
|
||||||
56 bytes from 10.180.0.1: icmp_seq=0 ttl=254 time=7.600 ms
|
64 bytes from 93.184.216.34: seq=0 ttl=37 time=93.052 ms
|
||||||
56 bytes from 10.180.0.1: icmp_seq=1 ttl=254 time=30.705 ms
|
64 bytes from 93.184.216.34: seq=1 ttl=37 time=92.467 ms
|
||||||
^C--- docker ping statistics ---
|
64 bytes from 93.184.216.34: seq=2 ttl=37 time=92.252 ms
|
||||||
2 packets transmitted, 2 packets received, 0% packet loss
|
^C
|
||||||
round-trip min/avg/max/stddev = 7.600/19.152/30.705/11.553 ms
|
--- docker ping statistics ---
|
||||||
|
4 packets transmitted, 4 packets received, 0% packet loss
|
||||||
|
round-trip min/avg/max = 92.209/92.495/93.052 ms
|
||||||
```
|
```
|
||||||
|
|
||||||
Sometimes you need to connect to the Docker host from within your
|
Sometimes you need to connect to the Docker host from within your
|
||||||
|
|
@ -1454,7 +1456,7 @@ examples: |-
|
||||||
using IPv4 or IPv6 networking in your containers. Use the following
|
using IPv4 or IPv6 networking in your containers. Use the following
|
||||||
flags for IPv4 address retrieval for a network device named `eth0`:
|
flags for IPv4 address retrieval for a network device named `eth0`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ HOSTIP=`ip -4 addr show scope global dev eth0 | grep inet | awk '{print $2}' | cut -d / -f 1 | sed -n 1p`
|
$ HOSTIP=`ip -4 addr show scope global dev eth0 | grep inet | awk '{print $2}' | cut -d / -f 1 | sed -n 1p`
|
||||||
$ docker run --add-host=docker:${HOSTIP} --rm -it debian
|
$ docker run --add-host=docker:${HOSTIP} --rm -it debian
|
||||||
```
|
```
|
||||||
|
|
@ -1470,7 +1472,7 @@ examples: |-
|
||||||
`--ulimit` is specified with a soft and hard limit as such:
|
`--ulimit` is specified with a soft and hard limit as such:
|
||||||
`<type>=<soft limit>[:<hard limit>]`, for example:
|
`<type>=<soft limit>[:<hard limit>]`, for example:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run --ulimit nofile=1024:1024 --rm debian sh -c "ulimit -n"
|
$ docker run --ulimit nofile=1024:1024 --rm debian sh -c "ulimit -n"
|
||||||
1024
|
1024
|
||||||
```
|
```
|
||||||
|
|
@ -1482,7 +1484,7 @@ examples: |-
|
||||||
> the default `ulimits` set on the daemon. The `as` option is disabled now.
|
> the default `ulimits` set on the daemon. The `as` option is disabled now.
|
||||||
> In other words, the following script is not supported:
|
> In other words, the following script is not supported:
|
||||||
>
|
>
|
||||||
> ```bash
|
> ```console
|
||||||
> $ docker run -it --ulimit as=1024 fedora /bin/bash`
|
> $ docker run -it --ulimit as=1024 fedora /bin/bash`
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
|
@ -1495,7 +1497,7 @@ examples: |-
|
||||||
maximum number of processes available to a user, not to a container. For example, start four
|
maximum number of processes available to a user, not to a container. For example, start four
|
||||||
containers with `daemon` user:
|
containers with `daemon` user:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d -u daemon --ulimit nproc=3 busybox top
|
$ docker run -d -u daemon --ulimit nproc=3 busybox top
|
||||||
|
|
||||||
$ docker run -d -u daemon --ulimit nproc=3 busybox top
|
$ docker run -d -u daemon --ulimit nproc=3 busybox top
|
||||||
|
|
@ -1511,9 +1513,12 @@ examples: |-
|
||||||
|
|
||||||
### Stop container with signal (--stop-signal)
|
### Stop container with signal (--stop-signal)
|
||||||
|
|
||||||
The `--stop-signal` flag sets the system call signal that will be sent to the container to exit.
|
The `--stop-signal` flag sets the system call signal that will be sent to the
|
||||||
This signal can be a valid unsigned number that matches a position in the kernel's syscall table, for instance 9,
|
container to exit. This signal can be a signal name in the format `SIG<NAME>`,
|
||||||
or a signal name in the format SIGNAME, for instance SIGKILL.
|
for instance `SIGKILL`, or an unsigned number that matches a position in the
|
||||||
|
kernel's syscall table, for instance `9`.
|
||||||
|
|
||||||
|
The default is `SIGTERM` if not specified.
|
||||||
|
|
||||||
### Optional security options (--security-opt)
|
### Optional security options (--security-opt)
|
||||||
|
|
||||||
|
|
@ -1522,8 +1527,16 @@ examples: |-
|
||||||
|
|
||||||
### Stop container with timeout (--stop-timeout)
|
### Stop container with timeout (--stop-timeout)
|
||||||
|
|
||||||
The `--stop-timeout` flag sets the timeout (in seconds) that a pre-defined (see `--stop-signal`) system call
|
The `--stop-timeout` flag sets the number of seconds to wait for the container
|
||||||
signal that will be sent to the container to exit. After timeout elapses the container will be killed with SIGKILL.
|
to stop after sending the pre-defined (see `--stop-signal`) system call signal.
|
||||||
|
If the container does not exit after the timeout elapses, it is forcibly killed
|
||||||
|
with a `SIGKILL` signal.
|
||||||
|
|
||||||
|
If `--stop-timeout` is set to `-1`, no timeout is applied, and the daemon will
|
||||||
|
wait indefinitely for the container to exit.
|
||||||
|
|
||||||
|
The default is determined by the daemon, and is 10 seconds for Linux containers,
|
||||||
|
and 30 seconds for Windows containers.
|
||||||
|
|
||||||
### Specify isolation technology for container (--isolation)
|
### Specify isolation technology for container (--isolation)
|
||||||
|
|
||||||
|
|
@ -1532,7 +1545,7 @@ examples: |-
|
||||||
On Linux, the only supported is the `default` option which uses
|
On Linux, the only supported is the `default` option which uses
|
||||||
Linux namespaces. These two commands are equivalent on Linux:
|
Linux namespaces. These two commands are equivalent on Linux:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d busybox top
|
$ docker run -d busybox top
|
||||||
$ docker run -d --isolation default busybox top
|
$ docker run -d --isolation default busybox top
|
||||||
```
|
```
|
||||||
|
|
@ -1613,7 +1626,7 @@ examples: |-
|
||||||
container. For example, to turn on IP forwarding in the containers
|
container. For example, to turn on IP forwarding in the containers
|
||||||
network namespace, run this command:
|
network namespace, run this command:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run --sysctl net.ipv4.ip_forward=1 someimage
|
$ docker run --sysctl net.ipv4.ip_forward=1 someimage
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### Create a backup that can then be used with `docker load`.
|
### Create a backup that can then be used with `docker load`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker save busybox > busybox.tar
|
$ docker save busybox > busybox.tar
|
||||||
|
|
||||||
$ ls -sh busybox.tar
|
$ ls -sh busybox.tar
|
||||||
|
|
@ -42,15 +42,15 @@ examples: |-
|
||||||
|
|
||||||
You can use gzip to save the image file and make the backup smaller.
|
You can use gzip to save the image file and make the backup smaller.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
docker save myimage:latest | gzip > myimage_latest.tar.gz
|
$ docker save myimage:latest | gzip > myimage_latest.tar.gz
|
||||||
```
|
```
|
||||||
|
|
||||||
### Cherry-pick particular tags
|
### Cherry-pick particular tags
|
||||||
|
|
||||||
You can even cherry-pick particular tags of an image repository.
|
You can even cherry-pick particular tags of an image repository.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker save -o ubuntu.tar ubuntu:lucid ubuntu:saucy
|
$ docker save -o ubuntu.tar ubuntu:lucid ubuntu:saucy
|
||||||
```
|
```
|
||||||
deprecated: false
|
deprecated: false
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ examples: |-
|
||||||
|
|
||||||
This example displays images with a name containing 'busybox':
|
This example displays images with a name containing 'busybox':
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker search busybox
|
$ docker search busybox
|
||||||
|
|
||||||
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
|
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
|
||||||
|
|
@ -81,8 +81,9 @@ examples: |-
|
||||||
This example displays images with a name containing 'busybox',
|
This example displays images with a name containing 'busybox',
|
||||||
at least 3 stars and the description isn't truncated in the output:
|
at least 3 stars and the description isn't truncated in the output:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker search --filter=stars=3 --no-trunc busybox
|
$ docker search --filter=stars=3 --no-trunc busybox
|
||||||
|
|
||||||
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
|
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
|
||||||
busybox Busybox base image. 325 [OK]
|
busybox Busybox base image. 325 [OK]
|
||||||
progrium/busybox 50 [OK]
|
progrium/busybox 50 [OK]
|
||||||
|
|
@ -110,7 +111,7 @@ examples: |-
|
||||||
This example displays images with a name containing 'busybox' and at
|
This example displays images with a name containing 'busybox' and at
|
||||||
least 3 stars:
|
least 3 stars:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker search --filter stars=3 busybox
|
$ docker search --filter stars=3 busybox
|
||||||
|
|
||||||
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
|
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
|
||||||
|
|
@ -124,7 +125,7 @@ examples: |-
|
||||||
This example displays images with a name containing 'busybox'
|
This example displays images with a name containing 'busybox'
|
||||||
and are automated builds:
|
and are automated builds:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker search --filter is-automated=true busybox
|
$ docker search --filter is-automated=true busybox
|
||||||
|
|
||||||
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
|
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
|
||||||
|
|
@ -137,7 +138,7 @@ examples: |-
|
||||||
This example displays images with a name containing 'busybox', at least
|
This example displays images with a name containing 'busybox', at least
|
||||||
3 stars and are official builds:
|
3 stars and are official builds:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker search --filter is-official=true --filter stars=3 busybox
|
$ docker search --filter is-official=true --filter stars=3 busybox
|
||||||
|
|
||||||
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
|
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
|
||||||
|
|
@ -167,7 +168,7 @@ examples: |-
|
||||||
The following example uses a template without headers and outputs the
|
The following example uses a template without headers and outputs the
|
||||||
`Name` and `StarCount` entries separated by a colon (`:`) for all images:
|
`Name` and `StarCount` entries separated by a colon (`:`) for all images:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker search --format "{{.Name}}: {{.StarCount}}" nginx
|
$ docker search --format "{{.Name}}: {{.StarCount}}" nginx
|
||||||
|
|
||||||
nginx: 5441
|
nginx: 5441
|
||||||
|
|
@ -184,7 +185,7 @@ examples: |-
|
||||||
|
|
||||||
This example outputs a table format:
|
This example outputs a table format:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker search --format "table {{.Name}}\t{{.IsAutomated}}\t{{.IsOfficial}}" nginx
|
$ docker search --format "table {{.Name}}\t{{.IsAutomated}}\t{{.IsOfficial}}" nginx
|
||||||
|
|
||||||
NAME AUTOMATED OFFICIAL
|
NAME AUTOMATED OFFICIAL
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### Create a secret
|
### Create a secret
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ printf <secret> | docker secret create my_secret -
|
$ printf "my super secret password" | docker secret create my_secret -
|
||||||
|
|
||||||
onakdyv307se2tl7nl20anokv
|
onakdyv307se2tl7nl20anokv
|
||||||
|
|
||||||
|
|
@ -59,7 +59,7 @@ examples: |-
|
||||||
|
|
||||||
### Create a secret with a file
|
### Create a secret with a file
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker secret create my_secret ./secret.json
|
$ docker secret create my_secret ./secret.json
|
||||||
|
|
||||||
dg426haahpi5ezmkkj5kyl3sn
|
dg426haahpi5ezmkkj5kyl3sn
|
||||||
|
|
@ -72,15 +72,16 @@ examples: |-
|
||||||
|
|
||||||
### Create a secret with labels
|
### Create a secret with labels
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker secret create --label env=dev \
|
$ docker secret create \
|
||||||
--label rev=20170324 \
|
--label env=dev \
|
||||||
my_secret ./secret.json
|
--label rev=20170324 \
|
||||||
|
my_secret ./secret.json
|
||||||
|
|
||||||
eo7jnzguqgtpdah3cm5srfb97
|
eo7jnzguqgtpdah3cm5srfb97
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker secret inspect my_secret
|
$ docker secret inspect my_secret
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -46,14 +46,14 @@ examples: |-
|
||||||
|
|
||||||
For example, given the following secret:
|
For example, given the following secret:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker secret ls
|
$ docker secret ls
|
||||||
|
|
||||||
ID NAME CREATED UPDATED
|
ID NAME CREATED UPDATED
|
||||||
eo7jnzguqgtpdah3cm5srfb97 my_secret 3 minutes ago 3 minutes ago
|
eo7jnzguqgtpdah3cm5srfb97 my_secret 3 minutes ago 3 minutes ago
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker secret inspect secret.json
|
$ docker secret inspect secret.json
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -85,7 +85,7 @@ examples: |-
|
||||||
secret. The following example command outputs the creation time of the
|
secret. The following example command outputs the creation time of the
|
||||||
secret.
|
secret.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker secret inspect --format='{{.CreatedAt}}' eo7jnzguqgtpdah3cm5srfb97
|
$ docker secret inspect --format='{{.CreatedAt}}' eo7jnzguqgtpdah3cm5srfb97
|
||||||
|
|
||||||
2017-03-24 08:15:09.735271783 +0000 UTC
|
2017-03-24 08:15:09.735271783 +0000 UTC
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ options:
|
||||||
kubernetes: false
|
kubernetes: false
|
||||||
swarm: false
|
swarm: false
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker secret ls
|
$ docker secret ls
|
||||||
|
|
||||||
ID NAME CREATED UPDATED
|
ID NAME CREATED UPDATED
|
||||||
|
|
@ -68,7 +68,7 @@ examples: |-
|
||||||
|
|
||||||
The `id` filter matches all or prefix of a secret's id.
|
The `id` filter matches all or prefix of a secret's id.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker secret ls -f "id=6697bflskwj1998km1gnnjr38"
|
$ docker secret ls -f "id=6697bflskwj1998km1gnnjr38"
|
||||||
|
|
||||||
ID NAME CREATED UPDATED
|
ID NAME CREATED UPDATED
|
||||||
|
|
@ -83,7 +83,7 @@ examples: |-
|
||||||
The following filter matches all secrets with a `project` label regardless of
|
The following filter matches all secrets with a `project` label regardless of
|
||||||
its value:
|
its value:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker secret ls --filter label=project
|
$ docker secret ls --filter label=project
|
||||||
|
|
||||||
ID NAME CREATED UPDATED
|
ID NAME CREATED UPDATED
|
||||||
|
|
@ -93,7 +93,7 @@ examples: |-
|
||||||
The following filter matches only services with the `project` label with the
|
The following filter matches only services with the `project` label with the
|
||||||
`project-a` value.
|
`project-a` value.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ls --filter label=project=test
|
$ docker service ls --filter label=project=test
|
||||||
|
|
||||||
ID NAME CREATED UPDATED
|
ID NAME CREATED UPDATED
|
||||||
|
|
@ -106,7 +106,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches secret with a name containing a prefix of `test`.
|
The following filter matches secret with a name containing a prefix of `test`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker secret ls --filter name=test_secret
|
$ docker secret ls --filter name=test_secret
|
||||||
|
|
||||||
ID NAME CREATED UPDATED
|
ID NAME CREATED UPDATED
|
||||||
|
|
@ -136,7 +136,7 @@ examples: |-
|
||||||
The following example uses a template without headers and outputs the
|
The following example uses a template without headers and outputs the
|
||||||
`ID` and `Name` entries separated by a colon (`:`) for all images:
|
`ID` and `Name` entries separated by a colon (`:`) for all images:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker secret ls --format "{{.ID}}: {{.Name}}"
|
$ docker secret ls --format "{{.ID}}: {{.Name}}"
|
||||||
|
|
||||||
77af4d6b9913: secret-1
|
77af4d6b9913: secret-1
|
||||||
|
|
@ -147,7 +147,7 @@ examples: |-
|
||||||
To list all secrets with their name and created date in a table format you
|
To list all secrets with their name and created date in a table format you
|
||||||
can use:
|
can use:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker secret ls --format "table {{.ID}}\t{{.Name}}\t{{.CreatedAt}}"
|
$ docker secret ls --format "table {{.ID}}\t{{.Name}}\t{{.CreatedAt}}"
|
||||||
|
|
||||||
ID NAME CREATED
|
ID NAME CREATED
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ plink: docker_secret.yaml
|
||||||
examples: |-
|
examples: |-
|
||||||
This example removes a secret:
|
This example removes a secret:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker secret rm secret.json
|
$ docker secret rm secret.json
|
||||||
sapth4csdo5b6wz2p5uimh5xg
|
sapth4csdo5b6wz2p5uimh5xg
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -671,7 +671,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### Create a service
|
### Create a service
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create --name redis redis:3.0.6
|
$ docker service create --name redis redis:3.0.6
|
||||||
|
|
||||||
dmu1ept4cxcfe8k8lhtux3ro3
|
dmu1ept4cxcfe8k8lhtux3ro3
|
||||||
|
|
@ -694,7 +694,7 @@ examples: |-
|
||||||
your image is stored on `registry.example.com`, which is a private registry, use
|
your image is stored on `registry.example.com`, which is a private registry, use
|
||||||
a command like the following:
|
a command like the following:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker login registry.example.com
|
$ docker login registry.example.com
|
||||||
|
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
|
|
@ -712,7 +712,7 @@ examples: |-
|
||||||
Use the `--replicas` flag to set the number of replica tasks for a replicated
|
Use the `--replicas` flag to set the number of replica tasks for a replicated
|
||||||
service. The following command creates a `redis` service with `5` replica tasks:
|
service. The following command creates a `redis` service with `5` replica tasks:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create --name redis --replicas=5 redis:3.0.6
|
$ docker service create --name redis --replicas=5 redis:3.0.6
|
||||||
|
|
||||||
4cdgfyky7ozwh3htjfw0d12qv
|
4cdgfyky7ozwh3htjfw0d12qv
|
||||||
|
|
@ -726,7 +726,7 @@ examples: |-
|
||||||
In the following example the desired state is `5` replicas, but the current
|
In the following example the desired state is `5` replicas, but the current
|
||||||
number of `RUNNING` tasks is `3`:
|
number of `RUNNING` tasks is `3`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ls
|
$ docker service ls
|
||||||
|
|
||||||
ID NAME MODE REPLICAS IMAGE
|
ID NAME MODE REPLICAS IMAGE
|
||||||
|
|
@ -736,7 +736,7 @@ examples: |-
|
||||||
Once all the tasks are created and `RUNNING`, the actual number of tasks is
|
Once all the tasks are created and `RUNNING`, the actual number of tasks is
|
||||||
equal to the desired number:
|
equal to the desired number:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ls
|
$ docker service ls
|
||||||
|
|
||||||
ID NAME MODE REPLICAS IMAGE
|
ID NAME MODE REPLICAS IMAGE
|
||||||
|
|
@ -750,7 +750,7 @@ examples: |-
|
||||||
|
|
||||||
Create a service specifying a secret:
|
Create a service specifying a secret:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create --name redis --secret secret.json redis:3.0.6
|
$ docker service create --name redis --secret secret.json redis:3.0.6
|
||||||
|
|
||||||
4cdgfyky7ozwh3htjfw0d12qv
|
4cdgfyky7ozwh3htjfw0d12qv
|
||||||
|
|
@ -758,7 +758,7 @@ examples: |-
|
||||||
|
|
||||||
Create a service specifying the secret, target, user/group ID, and mode:
|
Create a service specifying the secret, target, user/group ID, and mode:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create --name redis \
|
$ docker service create --name redis \
|
||||||
--secret source=ssh-key,target=ssh \
|
--secret source=ssh-key,target=ssh \
|
||||||
--secret source=app-key,target=app,uid=1000,gid=1001,mode=0400 \
|
--secret source=app-key,target=app,uid=1000,gid=1001,mode=0400 \
|
||||||
|
|
@ -787,13 +787,13 @@ examples: |-
|
||||||
pre-exist in the container. The `mode` is specified as a 4-number sequence such
|
pre-exist in the container. The `mode` is specified as a 4-number sequence such
|
||||||
as `0755`.
|
as `0755`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create --name=redis --config redis-conf redis:3.0.6
|
$ docker service create --name=redis --config redis-conf redis:3.0.6
|
||||||
```
|
```
|
||||||
|
|
||||||
Create a service with a config and specify the target location and file mode:
|
Create a service with a config and specify the target location and file mode:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create --name redis \
|
$ docker service create --name redis \
|
||||||
--config source=redis-conf,target=/etc/redis/redis.conf,mode=0400 redis:3.0.6
|
--config source=redis-conf,target=/etc/redis/redis.conf,mode=0400 redis:3.0.6
|
||||||
```
|
```
|
||||||
|
|
@ -806,7 +806,7 @@ examples: |-
|
||||||
|
|
||||||
### Create a service with a rolling update policy
|
### Create a service with a rolling update policy
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
--replicas 10 \
|
--replicas 10 \
|
||||||
--name redis \
|
--name redis \
|
||||||
|
|
@ -824,7 +824,7 @@ examples: |-
|
||||||
|
|
||||||
This sets an environment variable for all tasks in a service. For example:
|
This sets an environment variable for all tasks in a service. For example:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
--name redis_2 \
|
--name redis_2 \
|
||||||
--replicas 5 \
|
--replicas 5 \
|
||||||
|
|
@ -835,7 +835,7 @@ examples: |-
|
||||||
To specify multiple environment variables, specify multiple `--env` flags, each
|
To specify multiple environment variables, specify multiple `--env` flags, each
|
||||||
with a separate key-value pair.
|
with a separate key-value pair.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
--name redis_2 \
|
--name redis_2 \
|
||||||
--replicas 5 \
|
--replicas 5 \
|
||||||
|
|
@ -849,7 +849,7 @@ examples: |-
|
||||||
This option sets the docker service containers hostname to a specific string.
|
This option sets the docker service containers hostname to a specific string.
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create --name redis --hostname myredis redis:3.0.6
|
$ docker service create --name redis --hostname myredis redis:3.0.6
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -858,7 +858,7 @@ examples: |-
|
||||||
A label is a `key=value` pair that applies metadata to a service. To label a
|
A label is a `key=value` pair that applies metadata to a service. To label a
|
||||||
service with two labels:
|
service with two labels:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
--name redis_2 \
|
--name redis_2 \
|
||||||
--label com.example.foo="bar"
|
--label com.example.foo="bar"
|
||||||
|
|
@ -1162,7 +1162,7 @@ examples: |-
|
||||||
|
|
||||||
The following example creates a service that uses a named volume:
|
The following example creates a service that uses a named volume:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
--name my-service \
|
--name my-service \
|
||||||
--replicas 3 \
|
--replicas 3 \
|
||||||
|
|
@ -1192,7 +1192,7 @@ examples: |-
|
||||||
The following command creates a service with three replicas with an anonymous
|
The following command creates a service with three replicas with an anonymous
|
||||||
volume on `/path/in/container`:
|
volume on `/path/in/container`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
--name my-service \
|
--name my-service \
|
||||||
--replicas 3 \
|
--replicas 3 \
|
||||||
|
|
@ -1210,7 +1210,7 @@ examples: |-
|
||||||
The following example bind-mounts a host directory at `/path/in/container` in
|
The following example bind-mounts a host directory at `/path/in/container` in
|
||||||
the containers backing the service:
|
the containers backing the service:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
--name my-service \
|
--name my-service \
|
||||||
--mount type=bind,source=/path/on/host,destination=/path/in/container \
|
--mount type=bind,source=/path/on/host,destination=/path/in/container \
|
||||||
|
|
@ -1225,7 +1225,7 @@ examples: |-
|
||||||
|
|
||||||
The following command creates a global service:
|
The following command creates a global service:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
--name redis_2 \
|
--name redis_2 \
|
||||||
--mode global \
|
--mode global \
|
||||||
|
|
@ -1258,7 +1258,7 @@ examples: |-
|
||||||
For example, the following limits tasks for the redis service to nodes where the
|
For example, the following limits tasks for the redis service to nodes where the
|
||||||
node type label equals queue:
|
node type label equals queue:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
--name redis_2 \
|
--name redis_2 \
|
||||||
--constraint node.platform.os==linux \
|
--constraint node.platform.os==linux \
|
||||||
|
|
@ -1273,7 +1273,7 @@ examples: |-
|
||||||
In the example below, no node satisfying the constraint was found, causing the
|
In the example below, no node satisfying the constraint was found, causing the
|
||||||
service to not reconcile with the desired state:
|
service to not reconcile with the desired state:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
--name web \
|
--name web \
|
||||||
--constraint node.labels.region==east \
|
--constraint node.labels.region==east \
|
||||||
|
|
@ -1291,7 +1291,7 @@ examples: |-
|
||||||
After adding the `region=east` label to a node in the cluster, the service
|
After adding the `region=east` label to a node in the cluster, the service
|
||||||
reconciles, and the desired number of replicas are deployed:
|
reconciles, and the desired number of replicas are deployed:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker node update --label-add region=east yswe2dm4c5fdgtsrli1e8ya5l
|
$ docker node update --label-add region=east yswe2dm4c5fdgtsrli1e8ya5l
|
||||||
yswe2dm4c5fdgtsrli1e8ya5l
|
yswe2dm4c5fdgtsrli1e8ya5l
|
||||||
|
|
||||||
|
|
@ -1306,7 +1306,7 @@ examples: |-
|
||||||
nodes. One example of where this can be useful is to balance tasks over a set
|
nodes. One example of where this can be useful is to balance tasks over a set
|
||||||
of datacenters or availability zones. The example below illustrates this:
|
of datacenters or availability zones. The example below illustrates this:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
--replicas 9 \
|
--replicas 9 \
|
||||||
--name redis_2 \
|
--name redis_2 \
|
||||||
|
|
@ -1357,7 +1357,7 @@ examples: |-
|
||||||
Tasks are spread first over the various datacenters, and then over racks
|
Tasks are spread first over the various datacenters, and then over racks
|
||||||
(as indicated by the respective labels):
|
(as indicated by the respective labels):
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
--replicas 9 \
|
--replicas 9 \
|
||||||
--name redis_2 \
|
--name redis_2 \
|
||||||
|
|
@ -1382,7 +1382,7 @@ examples: |-
|
||||||
The following example requires that 4GB of memory be available and reservable
|
The following example requires that 4GB of memory be available and reservable
|
||||||
on a given node before scheduling the service to run on that node.
|
on a given node before scheduling the service to run on that node.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create --reserve-memory=4GB --name=too-big nginx:alpine
|
$ docker service create --reserve-memory=4GB --name=too-big nginx:alpine
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1395,7 +1395,7 @@ examples: |-
|
||||||
by the task to 4GB. The task will be scheduled even if each of your nodes has
|
by the task to 4GB. The task will be scheduled even if each of your nodes has
|
||||||
only 2GB of memory, because `--limit-memory` is an upper limit.
|
only 2GB of memory, because `--limit-memory` is an upper limit.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create --limit-memory=4GB --name=too-big nginx:alpine
|
$ docker service create --limit-memory=4GB --name=too-big nginx:alpine
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1450,7 +1450,7 @@ examples: |-
|
||||||
|
|
||||||
The example below illustrates this:
|
The example below illustrates this:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
--name nginx \
|
--name nginx \
|
||||||
--replicas 2 \
|
--replicas 2 \
|
||||||
|
|
@ -1466,7 +1466,7 @@ examples: |-
|
||||||
First, create an overlay network on a manager node the docker network create
|
First, create an overlay network on a manager node the docker network create
|
||||||
command:
|
command:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker network create --driver overlay my-network
|
$ docker network create --driver overlay my-network
|
||||||
|
|
||||||
etjpu59cykrptrgw0z0hk5snf
|
etjpu59cykrptrgw0z0hk5snf
|
||||||
|
|
@ -1478,7 +1478,7 @@ examples: |-
|
||||||
When you create a service and pass the `--network` flag to attach the service to
|
When you create a service and pass the `--network` flag to attach the service to
|
||||||
the overlay network:
|
the overlay network:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
--replicas 3 \
|
--replicas 3 \
|
||||||
--network my-network \
|
--network my-network \
|
||||||
|
|
@ -1503,7 +1503,7 @@ examples: |-
|
||||||
of arguments. The short version is positional, and allows you to specify the
|
of arguments. The short version is positional, and allows you to specify the
|
||||||
published port and target port separated by a colon (`:`).
|
published port and target port separated by a colon (`:`).
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create --name my_web --replicas 3 --publish 8080:80 nginx
|
$ docker service create --name my_web --replicas 3 --publish 8080:80 nginx
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1512,7 +1512,7 @@ examples: |-
|
||||||
mode when using the short format. Here is an example of using the long format
|
mode when using the short format. Here is an example of using the long format
|
||||||
for the same service as above:
|
for the same service as above:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create --name my_web --replicas 3 --publish published=8080,target=80 nginx
|
$ docker service create --name my_web --replicas 3 --publish published=8080,target=80 nginx
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1644,7 +1644,7 @@ examples: |-
|
||||||
In this example, we are going to set the template of the created containers based on the
|
In this example, we are going to set the template of the created containers based on the
|
||||||
service's name, the node's ID and hostname where it sits.
|
service's name, the node's ID and hostname where it sits.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
--name hosttempl \
|
--name hosttempl \
|
||||||
--hostname="{{.Node.Hostname}}-{{.Node.ID}}-{{.Service.Name}}"\
|
--hostname="{{.Node.Hostname}}-{{.Node.ID}}-{{.Service.Name}}"\
|
||||||
|
|
@ -1668,7 +1668,7 @@ examples: |-
|
||||||
configured for this particular node. To force a specific isolation mode, you can use
|
configured for this particular node. To force a specific isolation mode, you can use
|
||||||
the `--isolation` flag:
|
the `--isolation` flag:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create --name myservice --isolation=process microsoft/nanoserver
|
$ docker service create --name myservice --isolation=process microsoft/nanoserver
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1682,7 +1682,7 @@ examples: |-
|
||||||
You can narrow the kind of nodes your task can land on through the using the
|
You can narrow the kind of nodes your task can land on through the using the
|
||||||
`--generic-resource` flag (if the nodes advertise these resources):
|
`--generic-resource` flag (if the nodes advertise these resources):
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
--name cuda \
|
--name cuda \
|
||||||
--generic-resource "NVIDIA-GPU=2" \
|
--generic-resource "NVIDIA-GPU=2" \
|
||||||
|
|
@ -1699,7 +1699,7 @@ examples: |-
|
||||||
|
|
||||||
Jobs are started by using one of two modes, `replicated-job` or `global-job`
|
Jobs are started by using one of two modes, `replicated-job` or `global-job`
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create --name myjob \
|
$ docker service create --name myjob \
|
||||||
--mode replicated-job \
|
--mode replicated-job \
|
||||||
bash "true"
|
bash "true"
|
||||||
|
|
@ -1729,12 +1729,13 @@ examples: |-
|
||||||
the total number of replicas that are executing simultaneously at any one time,
|
the total number of replicas that are executing simultaneously at any one time,
|
||||||
the `--max-concurrent` flag can be used:
|
the `--max-concurrent` flag can be used:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create --name mythrottledjob \
|
$ docker service create \
|
||||||
--mode replicated-job \
|
--name mythrottledjob \
|
||||||
--replicas 10 \
|
--mode replicated-job \
|
||||||
--max-concurrent 2 \
|
--replicas 10 \
|
||||||
bash "true"
|
--max-concurrent 2 \
|
||||||
|
bash "true"
|
||||||
```
|
```
|
||||||
|
|
||||||
The above command will execute 10 Tasks in total, but only 2 of them will be
|
The above command will execute 10 Tasks in total, but only 2 of them will be
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ examples: |-
|
||||||
|
|
||||||
For example, given the following service;
|
For example, given the following service;
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ls
|
$ docker service ls
|
||||||
ID NAME MODE REPLICAS IMAGE
|
ID NAME MODE REPLICAS IMAGE
|
||||||
dmu1ept4cxcf redis replicated 3/3 redis:3.0.6
|
dmu1ept4cxcf redis replicated 3/3 redis:3.0.6
|
||||||
|
|
@ -53,7 +53,7 @@ examples: |-
|
||||||
Both `docker service inspect redis`, and `docker service inspect dmu1ept4cxcf`
|
Both `docker service inspect redis`, and `docker service inspect dmu1ept4cxcf`
|
||||||
produce the same result:
|
produce the same result:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service inspect redis
|
$ docker service inspect redis
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -101,7 +101,7 @@ examples: |-
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service inspect dmu1ept4cxcf
|
$ docker service inspect dmu1ept4cxcf
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -120,7 +120,7 @@ examples: |-
|
||||||
You can print the inspect output in a human-readable format instead of the default
|
You can print the inspect output in a human-readable format instead of the default
|
||||||
JSON output, by using the `--pretty` option:
|
JSON output, by using the `--pretty` option:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service inspect --pretty frontend
|
$ docker service inspect --pretty frontend
|
||||||
|
|
||||||
ID: c8wgl7q4ndfd52ni6qftkvnnp
|
ID: c8wgl7q4ndfd52ni6qftkvnnp
|
||||||
|
|
@ -155,7 +155,7 @@ examples: |-
|
||||||
service. For example, the following command outputs the number of replicas
|
service. For example, the following command outputs the number of replicas
|
||||||
of the "redis" service.
|
of the "redis" service.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service inspect --format='{{.Spec.Mode.Replicated.Replicas}}' redis
|
$ docker service inspect --format='{{.Spec.Mode.Replicated.Replicas}}' redis
|
||||||
|
|
||||||
10
|
10
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
On a manager node:
|
On a manager node:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ls
|
$ docker service ls
|
||||||
|
|
||||||
ID NAME MODE REPLICAS IMAGE
|
ID NAME MODE REPLICAS IMAGE
|
||||||
|
|
@ -75,7 +75,7 @@ examples: |-
|
||||||
|
|
||||||
The `id` filter matches all or part of a service's id.
|
The `id` filter matches all or part of a service's id.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ls -f "id=0bcjw"
|
$ docker service ls -f "id=0bcjw"
|
||||||
ID NAME MODE REPLICAS IMAGE
|
ID NAME MODE REPLICAS IMAGE
|
||||||
0bcjwfh8ychr redis replicated 1/1 redis:3.0.6
|
0bcjwfh8ychr redis replicated 1/1 redis:3.0.6
|
||||||
|
|
@ -89,7 +89,7 @@ examples: |-
|
||||||
The following filter matches all services with a `project` label regardless of
|
The following filter matches all services with a `project` label regardless of
|
||||||
its value:
|
its value:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ls --filter label=project
|
$ docker service ls --filter label=project
|
||||||
ID NAME MODE REPLICAS IMAGE
|
ID NAME MODE REPLICAS IMAGE
|
||||||
01sl1rp6nj5u frontend2 replicated 1/1 nginx:alpine
|
01sl1rp6nj5u frontend2 replicated 1/1 nginx:alpine
|
||||||
|
|
@ -100,7 +100,7 @@ examples: |-
|
||||||
The following filter matches only services with the `project` label with the
|
The following filter matches only services with the `project` label with the
|
||||||
`project-a` value.
|
`project-a` value.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ls --filter label=project=project-a
|
$ docker service ls --filter label=project=project-a
|
||||||
ID NAME MODE REPLICAS IMAGE
|
ID NAME MODE REPLICAS IMAGE
|
||||||
36xvvwwauej0 frontend replicated 5/5 nginx:alpine
|
36xvvwwauej0 frontend replicated 5/5 nginx:alpine
|
||||||
|
|
@ -113,7 +113,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches only `global` services.
|
The following filter matches only `global` services.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ls --filter mode=global
|
$ docker service ls --filter mode=global
|
||||||
ID NAME MODE REPLICAS IMAGE
|
ID NAME MODE REPLICAS IMAGE
|
||||||
w7y0v2yrn620 top global 1/1 busybox
|
w7y0v2yrn620 top global 1/1 busybox
|
||||||
|
|
@ -125,7 +125,7 @@ examples: |-
|
||||||
|
|
||||||
The following filter matches services with a name containing `redis`.
|
The following filter matches services with a name containing `redis`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ls --filter name=redis
|
$ docker service ls --filter name=redis
|
||||||
ID NAME MODE REPLICAS IMAGE
|
ID NAME MODE REPLICAS IMAGE
|
||||||
0bcjwfh8ychr redis replicated 1/1 redis:3.0.6
|
0bcjwfh8ychr redis replicated 1/1 redis:3.0.6
|
||||||
|
|
@ -154,7 +154,7 @@ examples: |-
|
||||||
The following example uses a template without headers and outputs the
|
The following example uses a template without headers and outputs the
|
||||||
`ID`, `Mode`, and `Replicas` entries separated by a colon (`:`) for all services:
|
`ID`, `Mode`, and `Replicas` entries separated by a colon (`:`) for all services:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ls --format "{{.ID}}: {{.Mode}} {{.Replicas}}"
|
$ docker service ls --format "{{.ID}}: {{.Mode}} {{.Replicas}}"
|
||||||
|
|
||||||
0zmvwuiu3vue: replicated 10/10
|
0zmvwuiu3vue: replicated 10/10
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ examples: |-
|
||||||
|
|
||||||
The following command shows all the tasks that are part of the `redis` service:
|
The following command shows all the tasks that are part of the `redis` service:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ps redis
|
$ docker service ps redis
|
||||||
|
|
||||||
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
||||||
|
|
@ -83,7 +83,7 @@ examples: |-
|
||||||
example, after updating the service to use the `redis:3.0.6` image, the output
|
example, after updating the service to use the `redis:3.0.6` image, the output
|
||||||
may look like this:
|
may look like this:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ps redis
|
$ docker service ps redis
|
||||||
|
|
||||||
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
||||||
|
|
@ -108,7 +108,7 @@ examples: |-
|
||||||
default, but is printed if `--no-trunc` is used. The `--no-trunc` option
|
default, but is printed if `--no-trunc` is used. The `--no-trunc` option
|
||||||
also shows the non-truncated task ID, and error-messages, as can be seen below;
|
also shows the non-truncated task ID, and error-messages, as can be seen below;
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ps --no-trunc redis
|
$ docker service ps --no-trunc redis
|
||||||
|
|
||||||
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
||||||
|
|
@ -137,7 +137,7 @@ examples: |-
|
||||||
|
|
||||||
The `id` filter matches on all or a prefix of a task's ID.
|
The `id` filter matches on all or a prefix of a task's ID.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ps -f "id=8" redis
|
$ docker service ps -f "id=8" redis
|
||||||
|
|
||||||
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
||||||
|
|
@ -149,8 +149,9 @@ examples: |-
|
||||||
|
|
||||||
The `name` filter matches on task names.
|
The `name` filter matches on task names.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ps -f "name=redis.1" redis
|
$ docker service ps -f "name=redis.1" redis
|
||||||
|
|
||||||
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
||||||
qihejybwf1x5 redis.1 redis:3.0.6 manager1 Running Running 8 seconds
|
qihejybwf1x5 redis.1 redis:3.0.6 manager1 Running Running 8 seconds
|
||||||
```
|
```
|
||||||
|
|
@ -160,8 +161,9 @@ examples: |-
|
||||||
|
|
||||||
The `node` filter matches on a node name or a node ID.
|
The `node` filter matches on a node name or a node ID.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ps -f "node=manager1" redis
|
$ docker service ps -f "node=manager1" redis
|
||||||
|
|
||||||
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
||||||
0qihejybwf1x redis.1 redis:3.0.6 manager1 Running Running 8 seconds
|
0qihejybwf1x redis.1 redis:3.0.6 manager1 Running Running 8 seconds
|
||||||
1x0v8yomsncd redis.5 redis:3.0.6 manager1 Running Running 8 seconds
|
1x0v8yomsncd redis.5 redis:3.0.6 manager1 Running Running 8 seconds
|
||||||
|
|
@ -198,8 +200,9 @@ examples: |-
|
||||||
The following example uses a template without headers and outputs the
|
The following example uses a template without headers and outputs the
|
||||||
`Name` and `Image` entries separated by a colon (`:`) for all tasks:
|
`Name` and `Image` entries separated by a colon (`:`) for all tasks:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ps --format "{{.Name}}: {{.Image}}" top
|
$ docker service ps --format "{{.Name}}: {{.Image}}" top
|
||||||
|
|
||||||
top.1: busybox
|
top.1: busybox
|
||||||
top.2: busybox
|
top.2: busybox
|
||||||
top.3: busybox
|
top.3: busybox
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ plink: docker_service.yaml
|
||||||
examples: |-
|
examples: |-
|
||||||
Remove the `redis` service:
|
Remove the `redis` service:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service rm redis
|
$ docker service rm redis
|
||||||
|
|
||||||
redis
|
redis
|
||||||
|
|
|
||||||
|
|
@ -49,13 +49,13 @@ examples: |-
|
||||||
|
|
||||||
Create a service with a single replica:
|
Create a service with a single replica:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create --name my-service -p 8080:80 nginx:alpine
|
$ docker service create --name my-service -p 8080:80 nginx:alpine
|
||||||
```
|
```
|
||||||
|
|
||||||
Confirm that the service is running with a single replica:
|
Confirm that the service is running with a single replica:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ls
|
$ docker service ls
|
||||||
|
|
||||||
ID NAME MODE REPLICAS IMAGE PORTS
|
ID NAME MODE REPLICAS IMAGE PORTS
|
||||||
|
|
@ -64,7 +64,7 @@ examples: |-
|
||||||
|
|
||||||
Update the service to use three replicas:
|
Update the service to use three replicas:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service update --replicas=3 my-service
|
$ docker service update --replicas=3 my-service
|
||||||
|
|
||||||
$ docker service ls
|
$ docker service ls
|
||||||
|
|
@ -76,7 +76,7 @@ examples: |-
|
||||||
Now roll back the service to its previous version, and confirm it is
|
Now roll back the service to its previous version, and confirm it is
|
||||||
running a single replica again:
|
running a single replica again:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service rollback my-service
|
$ docker service rollback my-service
|
||||||
|
|
||||||
$ docker service ls
|
$ docker service ls
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ examples: |-
|
||||||
|
|
||||||
The following command scales the "frontend" service to 50 tasks.
|
The following command scales the "frontend" service to 50 tasks.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service scale frontend=50
|
$ docker service scale frontend=50
|
||||||
|
|
||||||
frontend scaled to 50
|
frontend scaled to 50
|
||||||
|
|
@ -42,7 +42,7 @@ examples: |-
|
||||||
|
|
||||||
The following command tries to scale a global service to 10 tasks and returns an error.
|
The following command tries to scale a global service to 10 tasks and returns an error.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create --mode global --name backend backend:latest
|
$ docker service create --mode global --name backend backend:latest
|
||||||
|
|
||||||
b4g08uwuairexjub6ome6usqh
|
b4g08uwuairexjub6ome6usqh
|
||||||
|
|
@ -55,7 +55,7 @@ examples: |-
|
||||||
Directly afterwards, run `docker service ls`, to see the actual number of
|
Directly afterwards, run `docker service ls`, to see the actual number of
|
||||||
replicas.
|
replicas.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ls --filter name=frontend
|
$ docker service ls --filter name=frontend
|
||||||
|
|
||||||
ID NAME MODE REPLICAS IMAGE
|
ID NAME MODE REPLICAS IMAGE
|
||||||
|
|
@ -65,7 +65,7 @@ examples: |-
|
||||||
You can also scale a service using the [`docker service update`](service_update.md)
|
You can also scale a service using the [`docker service update`](service_update.md)
|
||||||
command. The following commands are equivalent:
|
command. The following commands are equivalent:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service scale frontend=50
|
$ docker service scale frontend=50
|
||||||
$ docker service update --replicas=50 frontend
|
$ docker service update --replicas=50 frontend
|
||||||
```
|
```
|
||||||
|
|
@ -76,7 +76,7 @@ examples: |-
|
||||||
tasks for multiple services at once. The following example scales both the
|
tasks for multiple services at once. The following example scales both the
|
||||||
backend and frontend services:
|
backend and frontend services:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service scale backend=3 frontend=5
|
$ docker service scale backend=3 frontend=5
|
||||||
|
|
||||||
backend scaled to 3
|
backend scaled to 3
|
||||||
|
|
|
||||||
|
|
@ -837,13 +837,13 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### Update a service
|
### Update a service
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service update --limit-cpu 2 redis
|
$ docker service update --limit-cpu 2 redis
|
||||||
```
|
```
|
||||||
|
|
||||||
### Perform a rolling restart with no parameter changes
|
### Perform a rolling restart with no parameter changes
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service update --force --update-parallelism 1 --update-delay 30s redis
|
$ docker service update --force --update-parallelism 1 --update-delay 30s redis
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -871,7 +871,7 @@ examples: |-
|
||||||
|
|
||||||
- The `--mount-rm` flag takes the `target` path of the mount.
|
- The `--mount-rm` flag takes the `target` path of the mount.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
--name=myservice \
|
--name=myservice \
|
||||||
--mount type=volume,source=test-data,target=/somewhere \
|
--mount type=volume,source=test-data,target=/somewhere \
|
||||||
|
|
@ -899,7 +899,7 @@ examples: |-
|
||||||
|
|
||||||
The following example adds a published service port to an existing service.
|
The following example adds a published service port to an existing service.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service update \
|
$ docker service update \
|
||||||
--publish-add published=8080,target=80 \
|
--publish-add published=8080,target=80 \
|
||||||
myservice
|
myservice
|
||||||
|
|
@ -914,7 +914,7 @@ examples: |-
|
||||||
|
|
||||||
The following example adds a new alias name to an existing service already connected to network my-network:
|
The following example adds a new alias name to an existing service already connected to network my-network:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service update \
|
$ docker service update \
|
||||||
--network-rm my-network \
|
--network-rm my-network \
|
||||||
--network-add name=my-network,alias=web1 \
|
--network-add name=my-network,alias=web1 \
|
||||||
|
|
@ -929,7 +929,7 @@ examples: |-
|
||||||
|
|
||||||
The following example updates the number of replicas for the service from 4 to 5, and then rolls back to the previous configuration.
|
The following example updates the number of replicas for the service from 4 to 5, and then rolls back to the previous configuration.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service update --replicas=5 web
|
$ docker service update --replicas=5 web
|
||||||
|
|
||||||
web
|
web
|
||||||
|
|
@ -940,9 +940,10 @@ examples: |-
|
||||||
80bvrzp6vxf3 web replicated 0/5 nginx:alpine
|
80bvrzp6vxf3 web replicated 0/5 nginx:alpine
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Roll back the `web` service...
|
Roll back the `web` service...
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service update --rollback web
|
$ docker service update --rollback web
|
||||||
|
|
||||||
web
|
web
|
||||||
|
|
@ -956,7 +957,7 @@ examples: |-
|
||||||
|
|
||||||
Other options can be combined with `--rollback` as well, for example, `--update-delay 0s` to execute the rollback without a delay between tasks:
|
Other options can be combined with `--rollback` as well, for example, `--update-delay 0s` to execute the rollback without a delay between tasks:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service update \
|
$ docker service update \
|
||||||
--rollback \
|
--rollback \
|
||||||
--update-delay 0s
|
--update-delay 0s
|
||||||
|
|
@ -993,7 +994,7 @@ examples: |-
|
||||||
|
|
||||||
The following example adds a secret named `ssh-2` and removes `ssh-1`:
|
The following example adds a secret named `ssh-2` and removes `ssh-1`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service update \
|
$ docker service update \
|
||||||
--secret-add source=ssh-2,target=ssh-2 \
|
--secret-add source=ssh-2,target=ssh-2 \
|
||||||
--secret-rm ssh-1 \
|
--secret-rm ssh-1 \
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ examples: |-
|
||||||
|
|
||||||
The `deploy` command supports compose file version `3.0` and above.
|
The `deploy` command supports compose file version `3.0` and above.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stack deploy --compose-file docker-compose.yml vossibility
|
$ docker stack deploy --compose-file docker-compose.yml vossibility
|
||||||
|
|
||||||
Ignoring unsupported options: links
|
Ignoring unsupported options: links
|
||||||
|
|
@ -102,7 +102,7 @@ examples: |-
|
||||||
|
|
||||||
The Compose file can also be provided as standard input with `--compose-file -`:
|
The Compose file can also be provided as standard input with `--compose-file -`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ cat docker-compose.yml | docker stack deploy --compose-file - vossibility
|
$ cat docker-compose.yml | docker stack deploy --compose-file - vossibility
|
||||||
|
|
||||||
Ignoring unsupported options: links
|
Ignoring unsupported options: links
|
||||||
|
|
@ -121,7 +121,7 @@ examples: |-
|
||||||
configuration and environment-specific overrides, you can provide multiple
|
configuration and environment-specific overrides, you can provide multiple
|
||||||
`--compose-file` flags.
|
`--compose-file` flags.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stack deploy --compose-file docker-compose.yml -c docker-compose.prod.yml vossibility
|
$ docker stack deploy --compose-file docker-compose.yml -c docker-compose.prod.yml vossibility
|
||||||
|
|
||||||
Ignoring unsupported options: links
|
Ignoring unsupported options: links
|
||||||
|
|
@ -138,7 +138,7 @@ examples: |-
|
||||||
|
|
||||||
You can verify that the services were correctly created:
|
You can verify that the services were correctly created:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker service ls
|
$ docker service ls
|
||||||
|
|
||||||
ID NAME MODE REPLICAS IMAGE
|
ID NAME MODE REPLICAS IMAGE
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ inherited_options:
|
||||||
examples: |-
|
examples: |-
|
||||||
The following command shows all stacks and some additional information:
|
The following command shows all stacks and some additional information:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stack ls
|
$ docker stack ls
|
||||||
|
|
||||||
ID SERVICES ORCHESTRATOR
|
ID SERVICES ORCHESTRATOR
|
||||||
|
|
@ -88,7 +88,7 @@ examples: |-
|
||||||
The following example uses a template without headers and outputs the
|
The following example uses a template without headers and outputs the
|
||||||
`Name` and `Services` entries separated by a colon (`:`) for all stacks:
|
`Name` and `Services` entries separated by a colon (`:`) for all stacks:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stack ls --format "{{.Name}}: {{.Services}}"
|
$ docker stack ls --format "{{.Name}}: {{.Services}}"
|
||||||
web-server: 1
|
web-server: 1
|
||||||
web-cache: 4
|
web-cache: 4
|
||||||
|
|
|
||||||
|
|
@ -88,8 +88,9 @@ examples: |-
|
||||||
|
|
||||||
The following command shows all the tasks that are part of the `voting` stack:
|
The following command shows all the tasks that are part of the `voting` stack:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stack ps voting
|
$ docker stack ps voting
|
||||||
|
|
||||||
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
||||||
xim5bcqtgk1b voting_worker.1 dockersamples/examplevotingapp_worker:latest node2 Running Running 2 minutes ago
|
xim5bcqtgk1b voting_worker.1 dockersamples/examplevotingapp_worker:latest node2 Running Running 2 minutes ago
|
||||||
q7yik0ks1in6 voting_result.1 dockersamples/examplevotingapp_result:before node1 Running Running 2 minutes ago
|
q7yik0ks1in6 voting_result.1 dockersamples/examplevotingapp_result:before node1 Running Running 2 minutes ago
|
||||||
|
|
@ -119,8 +120,9 @@ examples: |-
|
||||||
|
|
||||||
The `id` filter matches on all or a prefix of a task's ID.
|
The `id` filter matches on all or a prefix of a task's ID.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stack ps -f "id=t" voting
|
$ docker stack ps -f "id=t" voting
|
||||||
|
|
||||||
ID NAME IMAGE NODE DESIRED STATE CURRENTSTATE ERROR PORTS
|
ID NAME IMAGE NODE DESIRED STATE CURRENTSTATE ERROR PORTS
|
||||||
tz6j82jnwrx7 voting_db.1 postgres:9.4 node1 Running Running 14 minutes ago
|
tz6j82jnwrx7 voting_db.1 postgres:9.4 node1 Running Running 14 minutes ago
|
||||||
t72q3z038jeh voting_redis.2 redis:alpine node3 Running Running 14 minutes ago
|
t72q3z038jeh voting_redis.2 redis:alpine node3 Running Running 14 minutes ago
|
||||||
|
|
@ -130,8 +132,9 @@ examples: |-
|
||||||
|
|
||||||
The `name` filter matches on task names.
|
The `name` filter matches on task names.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stack ps -f "name=voting_redis" voting
|
$ docker stack ps -f "name=voting_redis" voting
|
||||||
|
|
||||||
ID NAME IMAGE NODE DESIRED STATE CURRENTSTATE ERROR PORTS
|
ID NAME IMAGE NODE DESIRED STATE CURRENTSTATE ERROR PORTS
|
||||||
w48spazhbmxc voting_redis.1 redis:alpine node2 Running Running 17 minutes ago
|
w48spazhbmxc voting_redis.1 redis:alpine node2 Running Running 17 minutes ago
|
||||||
t72q3z038jeh voting_redis.2 redis:alpine node3 Running Running 17 minutes ago
|
t72q3z038jeh voting_redis.2 redis:alpine node3 Running Running 17 minutes ago
|
||||||
|
|
@ -141,8 +144,9 @@ examples: |-
|
||||||
|
|
||||||
The `node` filter matches on a node name or a node ID.
|
The `node` filter matches on a node name or a node ID.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stack ps -f "node=node1" voting
|
$ docker stack ps -f "node=node1" voting
|
||||||
|
|
||||||
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
||||||
q7yik0ks1in6 voting_result.1 dockersamples/examplevotingapp_result:before node1 Running Running 18 minutes ago
|
q7yik0ks1in6 voting_result.1 dockersamples/examplevotingapp_result:before node1 Running Running 18 minutes ago
|
||||||
tz6j82jnwrx7 voting_db.1 postgres:9.4 node1 Running Running 18 minutes ago
|
tz6j82jnwrx7 voting_db.1 postgres:9.4 node1 Running Running 18 minutes ago
|
||||||
|
|
@ -153,8 +157,9 @@ examples: |-
|
||||||
|
|
||||||
The `desired-state` filter can take the values `running`, `shutdown`, `ready` or `accepted`.
|
The `desired-state` filter can take the values `running`, `shutdown`, `ready` or `accepted`.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stack ps -f "desired-state=running" voting
|
$ docker stack ps -f "desired-state=running" voting
|
||||||
|
|
||||||
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
||||||
xim5bcqtgk1b voting_worker.1 dockersamples/examplevotingapp_worker:latest node2 Running Running 21 minutes ago
|
xim5bcqtgk1b voting_worker.1 dockersamples/examplevotingapp_worker:latest node2 Running Running 21 minutes ago
|
||||||
q7yik0ks1in6 voting_result.1 dockersamples/examplevotingapp_result:before node1 Running Running 21 minutes ago
|
q7yik0ks1in6 voting_result.1 dockersamples/examplevotingapp_result:before node1 Running Running 21 minutes ago
|
||||||
|
|
@ -190,8 +195,9 @@ examples: |-
|
||||||
The following example uses a template without headers and outputs the
|
The following example uses a template without headers and outputs the
|
||||||
`Name` and `Image` entries separated by a colon (`:`) for all tasks:
|
`Name` and `Image` entries separated by a colon (`:`) for all tasks:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stack ps --format "{{.Name}}: {{.Image}}" voting
|
$ docker stack ps --format "{{.Name}}: {{.Image}}" voting
|
||||||
|
|
||||||
voting_worker.1: dockersamples/examplevotingapp_worker:latest
|
voting_worker.1: dockersamples/examplevotingapp_worker:latest
|
||||||
voting_result.1: dockersamples/examplevotingapp_result:before
|
voting_result.1: dockersamples/examplevotingapp_result:before
|
||||||
voting_vote.1: dockersamples/examplevotingapp_vote:before
|
voting_vote.1: dockersamples/examplevotingapp_vote:before
|
||||||
|
|
@ -206,8 +212,9 @@ examples: |-
|
||||||
|
|
||||||
The `--no-resolve` option shows IDs for task name, without mapping IDs to Names.
|
The `--no-resolve` option shows IDs for task name, without mapping IDs to Names.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stack ps --no-resolve voting
|
$ docker stack ps --no-resolve voting
|
||||||
|
|
||||||
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
|
||||||
xim5bcqtgk1b 10z9fjfqzsxnezo4hb81p8mqg.1 dockersamples/examplevotingapp_worker:latest qaqt4nrzo775jrx6detglho01 Running Running 30 minutes ago
|
xim5bcqtgk1b 10z9fjfqzsxnezo4hb81p8mqg.1 dockersamples/examplevotingapp_worker:latest qaqt4nrzo775jrx6detglho01 Running Running 30 minutes ago
|
||||||
q7yik0ks1in6 hbxltua1na7mgqjnidldv5m65.1 dockersamples/examplevotingapp_result:before mxpaef1tlh23s052erw88a4w5 Running Running 30 minutes ago
|
q7yik0ks1in6 hbxltua1na7mgqjnidldv5m65.1 dockersamples/examplevotingapp_result:before mxpaef1tlh23s052erw88a4w5 Running Running 30 minutes ago
|
||||||
|
|
@ -226,8 +233,9 @@ examples: |-
|
||||||
default, but is printed if `--no-trunc` is used. The `--no-trunc` option
|
default, but is printed if `--no-trunc` is used. The `--no-trunc` option
|
||||||
also shows the non-truncated task IDs, and error-messages, as can be seen below:
|
also shows the non-truncated task IDs, and error-messages, as can be seen below:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stack ps --no-trunc voting
|
$ docker stack ps --no-trunc voting
|
||||||
|
|
||||||
ID NAME IMAGE NODE DESIRED STATE CURREN STATE ERROR PORTS
|
ID NAME IMAGE NODE DESIRED STATE CURREN STATE ERROR PORTS
|
||||||
xim5bcqtgk1bxqz91jzo4a1s5 voting_worker.1 dockersamples/examplevotingapp_worker:latest@sha256:3e4ddf59c15f432280a2c0679c4fc5a2ee5a797023c8ef0d3baf7b1385e9fed node2 Running Runnin 32 minutes ago
|
xim5bcqtgk1bxqz91jzo4a1s5 voting_worker.1 dockersamples/examplevotingapp_worker:latest@sha256:3e4ddf59c15f432280a2c0679c4fc5a2ee5a797023c8ef0d3baf7b1385e9fed node2 Running Runnin 32 minutes ago
|
||||||
q7yik0ks1in6kv32gg6y6yjf7 voting_result.1 dockersamples/examplevotingapp_result:before@sha256:83b56996e930c292a6ae5187fda84dd6568a19d97cdb933720be15c757b7463 node1 Running Runnin 32 minutes ago
|
q7yik0ks1in6kv32gg6y6yjf7 voting_result.1 dockersamples/examplevotingapp_result:before@sha256:83b56996e930c292a6ae5187fda84dd6568a19d97cdb933720be15c757b7463 node1 Running Runnin 32 minutes ago
|
||||||
|
|
@ -244,7 +252,7 @@ examples: |-
|
||||||
The `-q ` or `--quiet` option only shows IDs of the tasks in the stack.
|
The `-q ` or `--quiet` option only shows IDs of the tasks in the stack.
|
||||||
This example outputs all task IDs of the "voting" stack;
|
This example outputs all task IDs of the "voting" stack;
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stack ps -q voting
|
$ docker stack ps -q voting
|
||||||
xim5bcqtgk1b
|
xim5bcqtgk1b
|
||||||
q7yik0ks1in6
|
q7yik0ks1in6
|
||||||
|
|
@ -260,14 +268,14 @@ examples: |-
|
||||||
the task IDs as input for other commands, such as `docker inspect`. The
|
the task IDs as input for other commands, such as `docker inspect`. The
|
||||||
following example inspects all tasks of the "voting" stack;
|
following example inspects all tasks of the "voting" stack;
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker inspect $(docker stack ps -q voting)
|
$ docker inspect $(docker stack ps -q voting)
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"ID": "xim5bcqtgk1b1gk0krq1",
|
"ID": "xim5bcqtgk1b1gk0krq1",
|
||||||
"Version": {
|
"Version": {
|
||||||
(...)
|
<...>
|
||||||
```
|
```
|
||||||
deprecated: false
|
deprecated: false
|
||||||
min_api_version: "1.25"
|
min_api_version: "1.25"
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ examples: |-
|
||||||
|
|
||||||
This will remove the stack with the name `myapp`. Services, networks, and secrets associated with the stack will be removed.
|
This will remove the stack with the name `myapp`. Services, networks, and secrets associated with the stack will be removed.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stack rm myapp
|
$ docker stack rm myapp
|
||||||
|
|
||||||
Removing service myapp_redis
|
Removing service myapp_redis
|
||||||
|
|
@ -58,7 +58,7 @@ examples: |-
|
||||||
|
|
||||||
This will remove all the specified stacks, `myapp` and `vossibility`. Services, networks, and secrets associated with all the specified stacks will be removed.
|
This will remove all the specified stacks, `myapp` and `vossibility`. Services, networks, and secrets associated with all the specified stacks will be removed.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stack rm myapp vossibility
|
$ docker stack rm myapp vossibility
|
||||||
|
|
||||||
Removing service myapp_redis
|
Removing service myapp_redis
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ inherited_options:
|
||||||
examples: |-
|
examples: |-
|
||||||
The following command shows all services in the `myapp` stack:
|
The following command shows all services in the `myapp` stack:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stack services myapp
|
$ docker stack services myapp
|
||||||
|
|
||||||
ID NAME REPLICAS IMAGE COMMAND
|
ID NAME REPLICAS IMAGE COMMAND
|
||||||
|
|
@ -84,7 +84,7 @@ examples: |-
|
||||||
|
|
||||||
The following command shows both the `web` and `db` services:
|
The following command shows both the `web` and `db` services:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stack services --filter name=myapp_web --filter name=myapp_db myapp
|
$ docker stack services --filter name=myapp_web --filter name=myapp_db myapp
|
||||||
|
|
||||||
ID NAME REPLICAS IMAGE COMMAND
|
ID NAME REPLICAS IMAGE COMMAND
|
||||||
|
|
@ -135,7 +135,7 @@ examples: |-
|
||||||
The following example uses a template without headers and outputs the
|
The following example uses a template without headers and outputs the
|
||||||
`ID`, `Mode`, and `Replicas` entries separated by a colon (`:`) for all services:
|
`ID`, `Mode`, and `Replicas` entries separated by a colon (`:`) for all services:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stack services --format "{{.ID}}: {{.Mode}} {{.Replicas}}"
|
$ docker stack services --format "{{.ID}}: {{.Mode}} {{.Replicas}}"
|
||||||
|
|
||||||
0zmvwuiu3vue: replicated 10/10
|
0zmvwuiu3vue: replicated 10/10
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ options:
|
||||||
kubernetes: false
|
kubernetes: false
|
||||||
swarm: false
|
swarm: false
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker start my_container
|
$ docker start my_container
|
||||||
```
|
```
|
||||||
deprecated: false
|
deprecated: false
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
Running `docker stats` on all running containers against a Linux daemon.
|
Running `docker stats` on all running containers against a Linux daemon.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stats
|
$ docker stats
|
||||||
|
|
||||||
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
|
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
|
||||||
|
|
@ -95,7 +95,7 @@ examples: |-
|
||||||
|
|
||||||
Running `docker stats` on multiple containers by name and id against a Linux daemon.
|
Running `docker stats` on multiple containers by name and id against a Linux daemon.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stats awesome_brattain 67b2525d8ad1
|
$ docker stats awesome_brattain 67b2525d8ad1
|
||||||
|
|
||||||
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
|
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
|
||||||
|
|
@ -105,7 +105,7 @@ examples: |-
|
||||||
|
|
||||||
Running `docker stats` with customized format on all (Running and Stopped) containers.
|
Running `docker stats` with customized format on all (Running and Stopped) containers.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stats --all --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}" fervent_panini 5acfcb1b4fd1 drunk_visvesvaraya big_heisenberg
|
$ docker stats --all --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}" fervent_panini 5acfcb1b4fd1 drunk_visvesvaraya big_heisenberg
|
||||||
|
|
||||||
CONTAINER CPU % MEM USAGE / LIMIT
|
CONTAINER CPU % MEM USAGE / LIMIT
|
||||||
|
|
@ -169,7 +169,7 @@ examples: |-
|
||||||
The following example uses a template without headers and outputs the
|
The following example uses a template without headers and outputs the
|
||||||
`Container` and `CPUPerc` entries separated by a colon (`:`) for all images:
|
`Container` and `CPUPerc` entries separated by a colon (`:`) for all images:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stats --format "{{.Container}}: {{.CPUPerc}}"
|
$ docker stats --format "{{.Container}}: {{.CPUPerc}}"
|
||||||
|
|
||||||
09d3bb5b1604: 6.61%
|
09d3bb5b1604: 6.61%
|
||||||
|
|
@ -180,7 +180,7 @@ examples: |-
|
||||||
To list all containers statistics with their name, CPU percentage and memory
|
To list all containers statistics with their name, CPU percentage and memory
|
||||||
usage in a table format you can use:
|
usage in a table format you can use:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker stats --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}"
|
$ docker stats --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}"
|
||||||
|
|
||||||
CONTAINER CPU % PRIV WORKING SET
|
CONTAINER CPU % PRIV WORKING SET
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ options:
|
||||||
kubernetes: false
|
kubernetes: false
|
||||||
swarm: false
|
swarm: false
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker stop my_container
|
$ docker stop my_container
|
||||||
```
|
```
|
||||||
deprecated: false
|
deprecated: false
|
||||||
|
|
|
||||||
|
|
@ -83,8 +83,9 @@ examples: |-
|
||||||
Run the `docker swarm ca` command without any options to view the current root CA certificate
|
Run the `docker swarm ca` command without any options to view the current root CA certificate
|
||||||
in PEM format.
|
in PEM format.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker swarm ca
|
$ docker swarm ca
|
||||||
|
|
||||||
-----BEGIN CERTIFICATE-----
|
-----BEGIN CERTIFICATE-----
|
||||||
MIIBazCCARCgAwIBAgIUJPzo67QC7g8Ebg2ansjkZ8CbmaswCgYIKoZIzj0EAwIw
|
MIIBazCCARCgAwIBAgIUJPzo67QC7g8Ebg2ansjkZ8CbmaswCgYIKoZIzj0EAwIw
|
||||||
EzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwNTAzMTcxMDAwWhcNMzcwNDI4MTcx
|
EzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwNTAzMTcxMDAwWhcNMzcwNDI4MTcx
|
||||||
|
|
@ -100,7 +101,7 @@ examples: |-
|
||||||
Pass the `--rotate` flag (and optionally a `--ca-cert`, along with a `--ca-key` or
|
Pass the `--rotate` flag (and optionally a `--ca-cert`, along with a `--ca-key` or
|
||||||
`--external-ca` parameter flag), in order to rotate the current swarm root CA.
|
`--external-ca` parameter flag), in order to rotate the current swarm root CA.
|
||||||
|
|
||||||
```
|
```console
|
||||||
$ docker swarm ca --rotate
|
$ docker swarm ca --rotate
|
||||||
desired root digest: sha256:05da740cf2577a25224c53019e2cce99bcc5ba09664ad6bb2a9425d9ebd1b53e
|
desired root digest: sha256:05da740cf2577a25224c53019e2cce99bcc5ba09664ad6bb2a9425d9ebd1b53e
|
||||||
rotated TLS certificates: [=========================> ] 1/2 nodes
|
rotated TLS certificates: [=========================> ] 1/2 nodes
|
||||||
|
|
@ -110,7 +111,7 @@ examples: |-
|
||||||
Once the rotation os finished (all the progress bars have completed) the now-current
|
Once the rotation os finished (all the progress bars have completed) the now-current
|
||||||
CA certificate will be printed:
|
CA certificate will be printed:
|
||||||
|
|
||||||
```
|
```console
|
||||||
$ docker swarm ca --rotate
|
$ docker swarm ca --rotate
|
||||||
desired root digest: sha256:05da740cf2577a25224c53019e2cce99bcc5ba09664ad6bb2a9425d9ebd1b53e
|
desired root digest: sha256:05da740cf2577a25224c53019e2cce99bcc5ba09664ad6bb2a9425d9ebd1b53e
|
||||||
rotated TLS certificates: [==================================================>] 2/2 nodes
|
rotated TLS certificates: [==================================================>] 2/2 nodes
|
||||||
|
|
|
||||||
|
|
@ -149,8 +149,9 @@ options:
|
||||||
kubernetes: false
|
kubernetes: false
|
||||||
swarm: false
|
swarm: false
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker swarm init --advertise-addr 192.168.99.121
|
$ docker swarm init --advertise-addr 192.168.99.121
|
||||||
|
|
||||||
Swarm initialized: current node (bvz81updecsj6wjz393c09vti) is now a manager.
|
Swarm initialized: current node (bvz81updecsj6wjz393c09vti) is now a manager.
|
||||||
|
|
||||||
To add a worker to this swarm, run the following command:
|
To add a worker to this swarm, run the following command:
|
||||||
|
|
@ -244,20 +245,21 @@ examples: |-
|
||||||
The following example initializes a new Swarm, and configures the data path
|
The following example initializes a new Swarm, and configures the data path
|
||||||
port to UDP port 7777;
|
port to UDP port 7777;
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
docker swarm init --data-path-port=7777
|
$ docker swarm init --data-path-port=7777
|
||||||
```
|
```
|
||||||
|
|
||||||
After the swarm is initialized, use the `docker info` command to verify that
|
After the swarm is initialized, use the `docker info` command to verify that
|
||||||
the port is configured:
|
the port is configured:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
docker info
|
$ docker info
|
||||||
...
|
<...>
|
||||||
ClusterID: 9vs5ygs0gguyyec4iqf2314c0
|
ClusterID: 9vs5ygs0gguyyec4iqf2314c0
|
||||||
Managers: 1
|
Managers: 1
|
||||||
Nodes: 1
|
Nodes: 1
|
||||||
Data Path Port: 7777
|
Data Path Port: 7777
|
||||||
...
|
<...>
|
||||||
```
|
```
|
||||||
|
|
||||||
### `--default-addr-pool`
|
### `--default-addr-pool`
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ examples: |-
|
||||||
`join-token` to print the full `docker swarm join` command to join a new node to
|
`join-token` to print the full `docker swarm join` command to join a new node to
|
||||||
the swarm:
|
the swarm:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker swarm join-token worker
|
$ docker swarm join-token worker
|
||||||
|
|
||||||
To add a worker to this swarm, run the following command:
|
To add a worker to this swarm, run the following command:
|
||||||
|
|
@ -63,7 +63,7 @@ examples: |-
|
||||||
|
|
||||||
Use the `--rotate` flag to generate a new join token for the specified role:
|
Use the `--rotate` flag to generate a new join token for the specified role:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker swarm join-token --rotate worker
|
$ docker swarm join-token --rotate worker
|
||||||
|
|
||||||
Successfully rotated worker join token.
|
Successfully rotated worker join token.
|
||||||
|
|
@ -79,7 +79,7 @@ examples: |-
|
||||||
|
|
||||||
The `-q` (or `--quiet`) flag only prints the token:
|
The `-q` (or `--quiet`) flag only prints the token:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker swarm join-token -q worker
|
$ docker swarm join-token -q worker
|
||||||
|
|
||||||
SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-b30ljddcqhef9b9v4rs7mel7t
|
SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-b30ljddcqhef9b9v4rs7mel7t
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,10 @@ examples: |-
|
||||||
|
|
||||||
The example below demonstrates joining a manager node using a manager token.
|
The example below demonstrates joining a manager node using a manager token.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker swarm join --token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2 192.168.99.121:2377
|
$ docker swarm join --token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2 192.168.99.121:2377
|
||||||
This node joined a swarm as a manager.
|
This node joined a swarm as a manager.
|
||||||
|
|
||||||
$ docker node ls
|
$ docker node ls
|
||||||
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
||||||
dkp8vy1dq1kxleu9g4u78tlag * manager2 Ready Active Reachable
|
dkp8vy1dq1kxleu9g4u78tlag * manager2 Ready Active Reachable
|
||||||
|
|
@ -74,9 +75,10 @@ examples: |-
|
||||||
|
|
||||||
The example below demonstrates joining a worker node using a worker token.
|
The example below demonstrates joining a worker node using a worker token.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker swarm join --token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx 192.168.99.121:2377
|
$ docker swarm join --token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx 192.168.99.121:2377
|
||||||
This node joined a swarm as a worker.
|
This node joined a swarm as a worker.
|
||||||
|
|
||||||
$ docker node ls
|
$ docker node ls
|
||||||
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
||||||
7ln70fl22uw2dvjn2ft53m3q5 worker2 Ready Active
|
7ln70fl22uw2dvjn2ft53m3q5 worker2 Ready Active
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
Consider the following swarm, as seen from the manager:
|
Consider the following swarm, as seen from the manager:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker node ls
|
$ docker node ls
|
||||||
|
|
||||||
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
|
||||||
|
|
@ -37,7 +37,7 @@ examples: |-
|
||||||
|
|
||||||
To remove `worker2`, issue the following command from `worker2` itself:
|
To remove `worker2`, issue the following command from `worker2` itself:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker swarm leave
|
$ docker swarm leave
|
||||||
|
|
||||||
Node left the default swarm.
|
Node left the default swarm.
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ options:
|
||||||
kubernetes: false
|
kubernetes: false
|
||||||
swarm: false
|
swarm: false
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker swarm unlock-key
|
$ docker swarm unlock-key
|
||||||
|
|
||||||
To unlock a swarm manager after it restarts, run the `docker swarm unlock`
|
To unlock a swarm manager after it restarts, run the `docker swarm unlock`
|
||||||
|
|
@ -53,7 +53,7 @@ examples: |-
|
||||||
Use the `--rotate` flag to rotate the unlock key to a new, randomly-generated
|
Use the `--rotate` flag to rotate the unlock key to a new, randomly-generated
|
||||||
key:
|
key:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker swarm unlock-key --rotate
|
$ docker swarm unlock-key --rotate
|
||||||
|
|
||||||
Successfully rotated manager unlock key.
|
Successfully rotated manager unlock key.
|
||||||
|
|
@ -69,7 +69,7 @@ examples: |-
|
||||||
|
|
||||||
The `-q` (or `--quiet`) flag only prints the key:
|
The `-q` (or `--quiet`) flag only prints the key:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker swarm unlock-key -q
|
$ docker swarm unlock-key -q
|
||||||
|
|
||||||
SWMKEY-1-7c37Cc8654o6p38HnroywCi19pllOnGtbdZEgtKxZu8
|
SWMKEY-1-7c37Cc8654o6p38HnroywCi19pllOnGtbdZEgtKxZu8
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ usage: docker swarm unlock
|
||||||
pname: docker swarm
|
pname: docker swarm
|
||||||
plink: docker_swarm.yaml
|
plink: docker_swarm.yaml
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker swarm unlock
|
$ docker swarm unlock
|
||||||
Please enter unlock key:
|
Please enter unlock key:
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ options:
|
||||||
kubernetes: false
|
kubernetes: false
|
||||||
swarm: false
|
swarm: false
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker swarm update --cert-expiry 720h
|
$ docker swarm update --cert-expiry 720h
|
||||||
```
|
```
|
||||||
deprecated: false
|
deprecated: false
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
By default the command will just show a summary of the data used:
|
By default the command will just show a summary of the data used:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker system df
|
$ docker system df
|
||||||
|
|
||||||
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
|
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
|
||||||
|
|
@ -39,7 +39,7 @@ examples: |-
|
||||||
|
|
||||||
A more detailed view can be requested using the `-v, --verbose` flag:
|
A more detailed view can be requested using the `-v, --verbose` flag:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker system df -v
|
$ docker system df -v
|
||||||
|
|
||||||
Images space usage:
|
Images space usage:
|
||||||
|
|
|
||||||
|
|
@ -176,13 +176,13 @@ examples: |-
|
||||||
|
|
||||||
**Shell 1: Listening for events:**
|
**Shell 1: Listening for events:**
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker system events
|
$ docker system events
|
||||||
```
|
```
|
||||||
|
|
||||||
**Shell 2: Start and Stop containers:**
|
**Shell 2: Start and Stop containers:**
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker create --name test alpine:latest top
|
$ docker create --name test alpine:latest top
|
||||||
$ docker start test
|
$ docker start test
|
||||||
$ docker stop test
|
$ docker stop test
|
||||||
|
|
@ -207,7 +207,7 @@ examples: |-
|
||||||
You can filter the output by an absolute timestamp or relative time on the host
|
You can filter the output by an absolute timestamp or relative time on the host
|
||||||
machine, using the following different time syntaxes:
|
machine, using the following different time syntaxes:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker system events --since 1483283804
|
$ docker system events --since 1483283804
|
||||||
|
|
||||||
2017-01-05T00:35:41.241772953+08:00 volume create testVol (driver=local)
|
2017-01-05T00:35:41.241772953+08:00 volume create testVol (driver=local)
|
||||||
|
|
@ -258,7 +258,7 @@ examples: |-
|
||||||
The following commands show several different ways to filter the `docker event`
|
The following commands show several different ways to filter the `docker event`
|
||||||
output.
|
output.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker system events --filter 'event=stop'
|
$ docker system events --filter 'event=stop'
|
||||||
|
|
||||||
2017-01-05T00:40:22.880175420+08:00 container stop 0fdb...ff37 (image=alpine:latest, name=test)
|
2017-01-05T00:40:22.880175420+08:00 container stop 0fdb...ff37 (image=alpine:latest, name=test)
|
||||||
|
|
@ -331,7 +331,7 @@ examples: |-
|
||||||
|
|
||||||
### Format the output
|
### Format the output
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker system events --filter 'type=container' --format 'Type={{.Type}} Status={{.Status}} ID={{.ID}}'
|
$ docker system events --filter 'type=container' --format 'Type={{.Type}} Status={{.Status}} ID={{.ID}}'
|
||||||
|
|
||||||
Type=container Status=create ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
Type=container Status=create ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
||||||
|
|
@ -344,7 +344,7 @@ examples: |-
|
||||||
|
|
||||||
#### Format as JSON
|
#### Format as JSON
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker system events --format '{{json .}}'
|
$ docker system events --format '{{json .}}'
|
||||||
|
|
||||||
{"status":"create","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
|
{"status":"create","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ options:
|
||||||
kubernetes: false
|
kubernetes: false
|
||||||
swarm: false
|
swarm: false
|
||||||
examples: |-
|
examples: |-
|
||||||
```bash
|
```console
|
||||||
$ docker system prune
|
$ docker system prune
|
||||||
|
|
||||||
WARNING! This will remove:
|
WARNING! This will remove:
|
||||||
|
|
@ -76,7 +76,7 @@ examples: |-
|
||||||
deleted if there is currently no container using the volume. Use the `--volumes`
|
deleted if there is currently no container using the volume. Use the `--volumes`
|
||||||
flag when running the command to prune volumes as well:
|
flag when running the command to prune volumes as well:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker system prune -a --volumes
|
$ docker system prune -a --volumes
|
||||||
|
|
||||||
WARNING! This will remove:
|
WARNING! This will remove:
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ examples: |-
|
||||||
To tag a local image with ID "0e5574283393" into the "fedora" repository with
|
To tag a local image with ID "0e5574283393" into the "fedora" repository with
|
||||||
"version1.0":
|
"version1.0":
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker tag 0e5574283393 fedora/httpd:version1.0
|
$ docker tag 0e5574283393 fedora/httpd:version1.0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -34,7 +34,7 @@ examples: |-
|
||||||
To tag a local image with name "httpd" into the "fedora" repository with
|
To tag a local image with name "httpd" into the "fedora" repository with
|
||||||
"version1.0":
|
"version1.0":
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker tag httpd fedora/httpd:version1.0
|
$ docker tag httpd fedora/httpd:version1.0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ examples: |-
|
||||||
To tag a local image with name "httpd" and tag "test" into the "fedora"
|
To tag a local image with name "httpd" and tag "test" into the "fedora"
|
||||||
repository with "version1.0.test":
|
repository with "version1.0.test":
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker tag httpd:test fedora/httpd:version1.0.test
|
$ docker tag httpd:test fedora/httpd:version1.0.test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ examples: |-
|
||||||
To push an image to a private registry and not the central Docker
|
To push an image to a private registry and not the central Docker
|
||||||
registry you must tag it with the registry hostname and port (if needed).
|
registry you must tag it with the registry hostname and port (if needed).
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker tag 0e5574283393 myregistryhost:5000/fedora/httpd:version1.0
|
$ docker tag 0e5574283393 myregistryhost:5000/fedora/httpd:version1.0
|
||||||
```
|
```
|
||||||
deprecated: false
|
deprecated: false
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ examples: |-
|
||||||
Use the `docker trust inspect` to get trust information about an image. The
|
Use the `docker trust inspect` to get trust information about an image. The
|
||||||
following example prints trust information for the `alpine:latest` image:
|
following example prints trust information for the `alpine:latest` image:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker trust inspect alpine:latest
|
$ docker trust inspect alpine:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -73,7 +73,7 @@ examples: |-
|
||||||
If signers are set up for the repository via other `docker trust`
|
If signers are set up for the repository via other `docker trust`
|
||||||
commands, `docker trust inspect` includes a `Signers` key:
|
commands, `docker trust inspect` includes a `Signers` key:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker trust inspect my-image:purple
|
$ docker trust inspect my-image:purple
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -151,7 +151,7 @@ examples: |-
|
||||||
If the image tag is unsigned or unavailable, `docker trust inspect` does not
|
If the image tag is unsigned or unavailable, `docker trust inspect` does not
|
||||||
display any signed tags.
|
display any signed tags.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker trust inspect unsigned-img
|
$ docker trust inspect unsigned-img
|
||||||
|
|
||||||
No signatures or cannot access unsigned-img
|
No signatures or cannot access unsigned-img
|
||||||
|
|
@ -160,7 +160,7 @@ examples: |-
|
||||||
However, if other tags are signed in the same image repository,
|
However, if other tags are signed in the same image repository,
|
||||||
`docker trust inspect` reports relevant key information:
|
`docker trust inspect` reports relevant key information:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker trust inspect alpine:unsigned
|
$ docker trust inspect alpine:unsigned
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -198,7 +198,7 @@ examples: |-
|
||||||
If no tag is specified, `docker trust inspect` will report details for all
|
If no tag is specified, `docker trust inspect` will report details for all
|
||||||
signed tags in the repository:
|
signed tags in the repository:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker trust inspect alpine
|
$ docker trust inspect alpine
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -267,7 +267,7 @@ examples: |-
|
||||||
`docker trust inspect` can take multiple repositories and images as arguments,
|
`docker trust inspect` can take multiple repositories and images as arguments,
|
||||||
and reports the results in an ordered list:
|
and reports the results in an ordered list:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker trust inspect alpine notary
|
$ docker trust inspect alpine notary
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -382,7 +382,7 @@ examples: |-
|
||||||
|
|
||||||
### Get details about signatures for a single image tag
|
### Get details about signatures for a single image tag
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker trust inspect --pretty alpine:latest
|
$ docker trust inspect --pretty alpine:latest
|
||||||
|
|
||||||
SIGNED TAG DIGEST SIGNERS
|
SIGNED TAG DIGEST SIGNERS
|
||||||
|
|
@ -404,7 +404,7 @@ examples: |-
|
||||||
`docker trust inspect --pretty` displays them appropriately as a `SIGNER`
|
`docker trust inspect --pretty` displays them appropriately as a `SIGNER`
|
||||||
and specify their `KEYS`:
|
and specify their `KEYS`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker trust inspect --pretty my-image:purple
|
$ docker trust inspect --pretty my-image:purple
|
||||||
|
|
||||||
SIGNED TAG DIGEST SIGNERS
|
SIGNED TAG DIGEST SIGNERS
|
||||||
|
|
@ -425,7 +425,7 @@ examples: |-
|
||||||
However, if other tags are signed in the same image repository,
|
However, if other tags are signed in the same image repository,
|
||||||
`docker trust inspect` reports relevant key information.
|
`docker trust inspect` reports relevant key information.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker trust inspect --pretty alpine:unsigned
|
$ docker trust inspect --pretty alpine:unsigned
|
||||||
|
|
||||||
No signatures for alpine:unsigned
|
No signatures for alpine:unsigned
|
||||||
|
|
@ -438,7 +438,7 @@ examples: |-
|
||||||
|
|
||||||
### Get details about signatures for all image tags in a repository
|
### Get details about signatures for all image tags in a repository
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker trust inspect --pretty alpine
|
$ docker trust inspect --pretty alpine
|
||||||
|
|
||||||
SIGNED TAG DIGEST SIGNERS
|
SIGNED TAG DIGEST SIGNERS
|
||||||
|
|
@ -460,7 +460,7 @@ examples: |-
|
||||||
|
|
||||||
Here's an example with signers that are set up by `docker trust` commands:
|
Here's an example with signers that are set up by `docker trust` commands:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker trust inspect --pretty my-image
|
$ docker trust inspect --pretty my-image
|
||||||
|
|
||||||
SIGNED TAG DIGEST SIGNERS
|
SIGNED TAG DIGEST SIGNERS
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ options:
|
||||||
examples: |-
|
examples: |-
|
||||||
### Generate a key-pair
|
### Generate a key-pair
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker trust key generate alice
|
$ docker trust key generate alice
|
||||||
|
|
||||||
Generating key for alice...
|
Generating key for alice...
|
||||||
|
|
@ -37,7 +37,7 @@ examples: |-
|
||||||
|
|
||||||
Provide the `--dir` argument to specify a directory to generate the key in:
|
Provide the `--dir` argument to specify a directory to generate the key in:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker trust key generate alice --dir /foo
|
$ docker trust key generate alice --dir /foo
|
||||||
|
|
||||||
Generating key for alice...
|
Generating key for alice...
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ examples: |-
|
||||||
|
|
||||||
For a private key `alice.pem` with permissions `-rw-------`
|
For a private key `alice.pem` with permissions `-rw-------`
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker trust key load alice.pem
|
$ docker trust key load alice.pem
|
||||||
|
|
||||||
Loading key from "alice.pem"...
|
Loading key from "alice.pem"...
|
||||||
|
|
@ -33,7 +33,7 @@ examples: |-
|
||||||
|
|
||||||
To specify a name use the `--name` flag:
|
To specify a name use the `--name` flag:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker trust key load --name alice-key alice.pem
|
$ docker trust key load --name alice-key alice.pem
|
||||||
|
|
||||||
Loading key from "alice.pem"...
|
Loading key from "alice.pem"...
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue