mirror of https://github.com/docker/docs.git
New CLI added
Signed-off-by: French Ben <frenchben@docker.com>
This commit is contained in:
parent
96338d0ea9
commit
a1933d276b
|
@ -107,3 +107,4 @@ clink:
|
||||||
- docker_version.yaml
|
- docker_version.yaml
|
||||||
- docker_volume.yaml
|
- docker_volume.yaml
|
||||||
- docker_wait.yaml
|
- docker_wait.yaml
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,57 @@
|
||||||
command: docker attach
|
command: docker attach
|
||||||
short: Attach to a running container
|
short: Attach to a running container
|
||||||
long: |2
|
long: |-
|
||||||
|
Use `docker attach` to attach to a running container using the container's ID
|
||||||
|
or name, either to view its ongoing output or to control it interactively.
|
||||||
|
You can attach to the same contained process multiple times simultaneously,
|
||||||
|
screen sharing style, or quickly view the progress of your detached process.
|
||||||
|
|
||||||
Alias for `docker container attach`.
|
To stop a container, use `CTRL-c`. This key sequence sends `SIGKILL` to the
|
||||||
|
container. If `--sig-proxy` is true (the default),`CTRL-c` sends a `SIGINT` to
|
||||||
|
the container. You can detach from a container and leave it running using the
|
||||||
|
`CTRL-p CTRL-q` key sequence.
|
||||||
|
|
||||||
|
> **Note:**
|
||||||
|
> A process running as PID 1 inside a container is treated specially by
|
||||||
|
> Linux: it ignores any signal with the default action. So, the process
|
||||||
|
> will not terminate on `SIGINT` or `SIGTERM` unless it is coded to do
|
||||||
|
> so.
|
||||||
|
|
||||||
|
It is forbidden to redirect the standard input of a `docker attach` command
|
||||||
|
while attaching to a tty-enabled container (i.e.: launched with `-t`).
|
||||||
|
|
||||||
|
While a client is connected to container's stdio using `docker attach`, Docker
|
||||||
|
uses a ~1MB memory buffer to maximize the throughput of the application. If
|
||||||
|
this buffer is filled, the speed of the API connection will start to have an
|
||||||
|
effect on the process output writing speed. This is similar to other
|
||||||
|
applications like SSH. Because of this, it is not recommended to run
|
||||||
|
performance critical applications that generate a lot of output in the
|
||||||
|
foreground over a slow client connection. Instead, users should use the
|
||||||
|
`docker logs` command to get access to the logs.
|
||||||
|
|
||||||
|
### Override the detach sequence
|
||||||
|
|
||||||
|
If you want, you can configure an override the Docker key sequence for detach.
|
||||||
|
This is useful if the Docker default sequence conflicts with key sequence you
|
||||||
|
use for other applications. There are two ways to define your own detach key
|
||||||
|
sequence, as a per-container override or as a configuration property on your
|
||||||
|
entire configuration.
|
||||||
|
|
||||||
|
To override the sequence for an individual container, use the
|
||||||
|
`--detach-keys="<sequence>"` flag with the `docker attach` command. The format of
|
||||||
|
the `<sequence>` is either a letter [a-Z], or the `ctrl-` combined with any of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
* `a-z` (a single lowercase alpha character )
|
||||||
|
* `@` (at sign)
|
||||||
|
* `[` (left bracket)
|
||||||
|
* `\\` (two backward slashes)
|
||||||
|
* `_` (underscore)
|
||||||
|
* `^` (caret)
|
||||||
|
|
||||||
|
These `a`, `ctrl-a`, `X`, or `ctrl-\\` values are all examples of valid key
|
||||||
|
sequences. To configure a different configuration default key sequence for all
|
||||||
|
containers, see [**Configuration file** section](cli.md#configuration-files).
|
||||||
usage: docker attach [OPTIONS] CONTAINER
|
usage: docker attach [OPTIONS] CONTAINER
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -15,3 +64,72 @@ options:
|
||||||
- option: sig-proxy
|
- option: sig-proxy
|
||||||
default_value: "true"
|
default_value: "true"
|
||||||
description: Proxy all received signals to the process
|
description: Proxy all received signals to the process
|
||||||
|
example: |-
|
||||||
|
### Attach to and detach from a running container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker run -d --name topdemo ubuntu /usr/bin/top -b
|
||||||
|
|
||||||
|
$ docker attach topdemo
|
||||||
|
|
||||||
|
top - 02:05:52 up 3:05, 0 users, load average: 0.01, 0.02, 0.05
|
||||||
|
Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
|
||||||
|
Cpu(s): 0.1%us, 0.2%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
|
||||||
|
Mem: 373572k total, 355560k used, 18012k free, 27872k buffers
|
||||||
|
Swap: 786428k total, 0k used, 786428k free, 221740k cached
|
||||||
|
|
||||||
|
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
|
||||||
|
1 root 20 0 17200 1116 912 R 0 0.3 0:00.03 top
|
||||||
|
|
||||||
|
top - 02:05:55 up 3:05, 0 users, load average: 0.01, 0.02, 0.05
|
||||||
|
Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
|
||||||
|
Cpu(s): 0.0%us, 0.2%sy, 0.0%ni, 99.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
|
||||||
|
Mem: 373572k total, 355244k used, 18328k free, 27872k buffers
|
||||||
|
Swap: 786428k total, 0k used, 786428k free, 221776k cached
|
||||||
|
|
||||||
|
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
|
||||||
|
1 root 20 0 17208 1144 932 R 0 0.3 0:00.03 top
|
||||||
|
|
||||||
|
|
||||||
|
top - 02:05:58 up 3:06, 0 users, load average: 0.01, 0.02, 0.05
|
||||||
|
Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
|
||||||
|
Cpu(s): 0.2%us, 0.3%sy, 0.0%ni, 99.5%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
|
||||||
|
Mem: 373572k total, 355780k used, 17792k free, 27880k buffers
|
||||||
|
Swap: 786428k total, 0k used, 786428k free, 221776k cached
|
||||||
|
|
||||||
|
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
|
||||||
|
1 root 20 0 17208 1144 932 R 0 0.3 0:00.03 top
|
||||||
|
^C$
|
||||||
|
|
||||||
|
$ echo $?
|
||||||
|
0
|
||||||
|
$ docker ps -a | grep topdemo
|
||||||
|
|
||||||
|
7998ac8581f9 ubuntu:14.04 "/usr/bin/top -b" 38 seconds ago Exited (0) 21 seconds ago topdemo
|
||||||
|
```
|
||||||
|
|
||||||
|
### Get the exit code of the container's command
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker run --name test -d -it debian
|
||||||
|
|
||||||
|
275c44472aebd77c926d4527885bb09f2f6db21d878c75f0a1c212c03d3bcfab
|
||||||
|
|
||||||
|
$ docker attach test
|
||||||
|
|
||||||
|
root@f38c87f2a42d:/# exit 13
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
|
$ echo $?
|
||||||
|
|
||||||
|
13
|
||||||
|
|
||||||
|
$ docker ps -a | grep test
|
||||||
|
|
||||||
|
275c44472aeb debian:7 "/bin/bash" 26 seconds ago Exited (13) 17 seconds ago test
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,107 @@
|
||||||
command: docker build
|
command: docker build
|
||||||
short: Build an image from a Dockerfile
|
short: Build an image from a Dockerfile
|
||||||
long: Build an image from a Dockerfile
|
long: |-
|
||||||
|
Builds Docker images from a Dockerfile and a "context". A build's context is
|
||||||
|
the files located in the specified `PATH` or `URL`. The build process can refer
|
||||||
|
to any of the files in the context. For example, your build can use an
|
||||||
|
[*ADD*](../builder.md#add) instruction to reference a file in the
|
||||||
|
context.
|
||||||
|
|
||||||
|
The `URL` parameter can refer to three kinds of resources: Git repositories,
|
||||||
|
pre-packaged tarball contexts and plain text files.
|
||||||
|
|
||||||
|
### Git repositories
|
||||||
|
|
||||||
|
When the `URL` parameter points to the location of a Git repository, the
|
||||||
|
repository acts as the build context. The system recursively clones the
|
||||||
|
repository and its submodules using a `git clone --depth 1 --recursive`
|
||||||
|
command. This command runs in a temporary directory on your local host. After
|
||||||
|
the command succeeds, the directory is sent to the Docker daemon as the
|
||||||
|
context. Local clones give you the ability to access private repositories using
|
||||||
|
local user credentials, VPN's, and so forth.
|
||||||
|
|
||||||
|
Git URLs accept context configuration in their fragment section, separated by a
|
||||||
|
colon `:`. The first part represents the reference that Git will check out,
|
||||||
|
this can be either a branch, a tag, or a commit SHA. The second part represents
|
||||||
|
a subdirectory inside the repository that will be used as a build context.
|
||||||
|
|
||||||
|
For example, run this command to use a directory called `docker` in the branch
|
||||||
|
`container`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker build https://github.com/docker/rootfs.git#container:docker
|
||||||
|
```
|
||||||
|
|
||||||
|
The following table represents all the valid suffixes with their build
|
||||||
|
contexts:
|
||||||
|
|
||||||
|
Build Syntax Suffix | Commit Used | Build Context Used
|
||||||
|
--------------------------------|-----------------------|-------------------
|
||||||
|
`myrepo.git` | `refs/heads/master` | `/`
|
||||||
|
`myrepo.git#mytag` | `refs/tags/mytag` | `/`
|
||||||
|
`myrepo.git#mybranch` | `refs/heads/mybranch` | `/`
|
||||||
|
`myrepo.git#abcdef` | `sha1 = abcdef` | `/`
|
||||||
|
`myrepo.git#:myfolder` | `refs/heads/master` | `/myfolder`
|
||||||
|
`myrepo.git#master:myfolder` | `refs/heads/master` | `/myfolder`
|
||||||
|
`myrepo.git#mytag:myfolder` | `refs/tags/mytag` | `/myfolder`
|
||||||
|
`myrepo.git#mybranch:myfolder` | `refs/heads/mybranch` | `/myfolder`
|
||||||
|
`myrepo.git#abcdef:myfolder` | `sha1 = abcdef` | `/myfolder`
|
||||||
|
|
||||||
|
|
||||||
|
### Tarball contexts
|
||||||
|
|
||||||
|
If you pass an URL to a remote tarball, the URL itself is sent to the daemon:
|
||||||
|
|
||||||
|
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`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker build http://server/context.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
The download operation will be performed on the host the Docker daemon is
|
||||||
|
running on, which is not necessarily the same host from which the build command
|
||||||
|
is being issued. The Docker daemon will fetch `context.tar.gz` and use it as the
|
||||||
|
build context. Tarball contexts must be tar archives conforming to the standard
|
||||||
|
`tar` UNIX format and can be compressed with any one of the 'xz', 'bzip2',
|
||||||
|
'gzip' or 'identity' (no compression) formats.
|
||||||
|
|
||||||
|
### Text files
|
||||||
|
|
||||||
|
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`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker build - < Dockerfile
|
||||||
|
```
|
||||||
|
|
||||||
|
With Powershell on Windows, you can run:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Get-Content Dockerfile | docker build -
|
||||||
|
```
|
||||||
|
|
||||||
|
If you use `STDIN` or specify a `URL` pointing to a plain text file, the system
|
||||||
|
places the contents into a file called `Dockerfile`, and any `-f`, `--file`
|
||||||
|
option is ignored. In this scenario, there is no context.
|
||||||
|
|
||||||
|
By default the `docker build` command will look for a `Dockerfile` at the root
|
||||||
|
of the build context. The `-f`, `--file`, option lets you specify the path to
|
||||||
|
an alternative file to use instead. This is useful in cases where the same set
|
||||||
|
of files are used for multiple builds. The path must be to a file within the
|
||||||
|
build context. If a relative path is specified then it is interpreted as
|
||||||
|
relative to the root of the context.
|
||||||
|
|
||||||
|
In most cases, it's best to put each Dockerfile in an empty directory. Then,
|
||||||
|
add to that directory only the files needed for building the Dockerfile. To
|
||||||
|
increase the build's performance, you can exclude files and directories by
|
||||||
|
adding a `.dockerignore` file to that directory as well. For information on
|
||||||
|
creating one, see the [.dockerignore file](../builder.md#dockerignore-file).
|
||||||
|
|
||||||
|
If the Docker client loses connection to the daemon, the build is canceled.
|
||||||
|
This happens if you interrupt the Docker client with `CTRL-c` or if the Docker
|
||||||
|
client is killed for any reason. If the build initiated a pull which is still
|
||||||
|
running at the time the build is cancelled, the pull is cancelled as well.
|
||||||
usage: docker build [OPTIONS] PATH | URL | -
|
usage: docker build [OPTIONS] PATH | URL | -
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -71,7 +172,8 @@ options:
|
||||||
default_value: '[]'
|
default_value: '[]'
|
||||||
description: Security options
|
description: Security options
|
||||||
- option: shm-size
|
- option: shm-size
|
||||||
description: Size of /dev/shm, default value is 64MB
|
default_value: "0"
|
||||||
|
description: Size of /dev/shm
|
||||||
- option: squash
|
- option: squash
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Squash newly built layers into a single new layer
|
description: Squash newly built layers into a single new layer
|
||||||
|
@ -82,3 +184,266 @@ options:
|
||||||
- option: ulimit
|
- option: ulimit
|
||||||
default_value: '[]'
|
default_value: '[]'
|
||||||
description: Ulimit options
|
description: Ulimit options
|
||||||
|
example: |-
|
||||||
|
### Build with PATH
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker build .
|
||||||
|
|
||||||
|
Uploading context 10240 bytes
|
||||||
|
Step 1/3 : FROM busybox
|
||||||
|
Pulling repository busybox
|
||||||
|
---> e9aa60c60128MB/2.284 MB (100%) endpoint: https://cdn-registry-1.docker.io/v1/
|
||||||
|
Step 2/3 : RUN ls -lh /
|
||||||
|
---> Running in 9c9e81692ae9
|
||||||
|
total 24
|
||||||
|
drwxr-xr-x 2 root root 4.0K Mar 12 2013 bin
|
||||||
|
drwxr-xr-x 5 root root 4.0K Oct 19 00:19 dev
|
||||||
|
drwxr-xr-x 2 root root 4.0K Oct 19 00:19 etc
|
||||||
|
drwxr-xr-x 2 root root 4.0K Nov 15 23:34 lib
|
||||||
|
lrwxrwxrwx 1 root root 3 Mar 12 2013 lib64 -> lib
|
||||||
|
dr-xr-xr-x 116 root root 0 Nov 15 23:34 proc
|
||||||
|
lrwxrwxrwx 1 root root 3 Mar 12 2013 sbin -> bin
|
||||||
|
dr-xr-xr-x 13 root root 0 Nov 15 23:34 sys
|
||||||
|
drwxr-xr-x 2 root root 4.0K Mar 12 2013 tmp
|
||||||
|
drwxr-xr-x 2 root root 4.0K Nov 15 23:34 usr
|
||||||
|
---> b35f4035db3f
|
||||||
|
Step 3/3 : CMD echo Hello world
|
||||||
|
---> Running in 02071fceb21b
|
||||||
|
---> f52f38b7823e
|
||||||
|
Successfully built f52f38b7823e
|
||||||
|
Removing intermediate container 9c9e81692ae9
|
||||||
|
Removing intermediate container 02071fceb21b
|
||||||
|
```
|
||||||
|
|
||||||
|
This example specifies that the `PATH` is `.`, and so all the files in the
|
||||||
|
local directory get `tar`d and sent to the Docker daemon. The `PATH` specifies
|
||||||
|
where to find the files for the "context" of the build on the Docker daemon.
|
||||||
|
Remember that the daemon could be running on a remote machine and that no
|
||||||
|
parsing of the Dockerfile happens at the client side (where you're running
|
||||||
|
`docker build`). That means that *all* the files at `PATH` get sent, not just
|
||||||
|
the ones listed to [*ADD*](../builder.md#add) in the Dockerfile.
|
||||||
|
|
||||||
|
The transfer of context from the local machine to the Docker daemon is what the
|
||||||
|
`docker` client means when you see the "Sending build context" message.
|
||||||
|
|
||||||
|
If you wish to keep the intermediate containers after the build is complete,
|
||||||
|
you must use `--rm=false`. This does not affect the build cache.
|
||||||
|
|
||||||
|
### Build with URL
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker build github.com/creack/docker-firefox
|
||||||
|
```
|
||||||
|
|
||||||
|
This will clone the GitHub repository and use the cloned repository as context.
|
||||||
|
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.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker build -f ctx/Dockerfile http://server/ctx.tar.gz
|
||||||
|
|
||||||
|
Downloading context: http://server/ctx.tar.gz [===================>] 240 B/240 B
|
||||||
|
Step 1/3 : FROM busybox
|
||||||
|
---> 8c2e06607696
|
||||||
|
Step 2/3 : ADD ctx/container.cfg /
|
||||||
|
---> e7829950cee3
|
||||||
|
Removing intermediate container b35224abf821
|
||||||
|
Step 3/3 : CMD /bin/ls
|
||||||
|
---> Running in fbc63d321d73
|
||||||
|
---> 3286931702ad
|
||||||
|
Removing intermediate container fbc63d321d73
|
||||||
|
Successfully built 377c409b35e4
|
||||||
|
```
|
||||||
|
|
||||||
|
This sends the URL `http://server/ctx.tar.gz` to the Docker daemon, which
|
||||||
|
downloads and extracts the referenced tarball. The `-f ctx/Dockerfile`
|
||||||
|
parameter specifies a path inside `ctx.tar.gz` to the `Dockerfile` that is used
|
||||||
|
to build the image. Any `ADD` commands in that `Dockerfile` that refers to local
|
||||||
|
paths must be relative to the root of the contents inside `ctx.tar.gz`. In the
|
||||||
|
example above, the tarball contains a directory `ctx/`, so the `ADD
|
||||||
|
ctx/container.cfg /` operation works as expected.
|
||||||
|
|
||||||
|
### Build with -
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker build - < Dockerfile
|
||||||
|
```
|
||||||
|
|
||||||
|
This will read a Dockerfile from `STDIN` without context. Due to the lack of a
|
||||||
|
context, no contents of any local directory will be sent to the Docker daemon.
|
||||||
|
Since there is no context, a Dockerfile `ADD` only works if it refers to a
|
||||||
|
remote URL.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker build - < context.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
This will build an image for a compressed context read from `STDIN`. Supported
|
||||||
|
formats are: bzip2, gzip and xz.
|
||||||
|
|
||||||
|
### Use a .dockerignore file
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker build .
|
||||||
|
|
||||||
|
Uploading context 18.829 MB
|
||||||
|
Uploading context
|
||||||
|
Step 1/2 : FROM busybox
|
||||||
|
---> 769b9341d937
|
||||||
|
Step 2/2 : CMD echo Hello world
|
||||||
|
---> Using cache
|
||||||
|
---> 99cc1ad10469
|
||||||
|
Successfully built 99cc1ad10469
|
||||||
|
$ echo ".git" > .dockerignore
|
||||||
|
$ docker build .
|
||||||
|
Uploading context 6.76 MB
|
||||||
|
Uploading context
|
||||||
|
Step 1/2 : FROM busybox
|
||||||
|
---> 769b9341d937
|
||||||
|
Step 2/2 : CMD echo Hello world
|
||||||
|
---> Using cache
|
||||||
|
---> 99cc1ad10469
|
||||||
|
Successfully built 99cc1ad10469
|
||||||
|
```
|
||||||
|
|
||||||
|
This example shows the use of the `.dockerignore` file to exclude the `.git`
|
||||||
|
directory from the context. Its effect can be seen in the changed size of the
|
||||||
|
uploaded context. The builder reference contains detailed information on
|
||||||
|
[creating a .dockerignore file](../builder.md#dockerignore-file)
|
||||||
|
|
||||||
|
### Tag an image (-t)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker build -t vieux/apache:2.0 .
|
||||||
|
```
|
||||||
|
|
||||||
|
This will build like the previous example, but it will then tag the resulting
|
||||||
|
image. The repository name will be `vieux/apache` and the tag will be `2.0`.
|
||||||
|
[Read more about valid tags](tag.md).
|
||||||
|
|
||||||
|
You can apply multiple tags to an image. For example, you can apply the `latest`
|
||||||
|
tag to a newly built image and add another tag that references a specific
|
||||||
|
version.
|
||||||
|
For example, to tag an image both as `whenry/fedora-jboss:latest` and
|
||||||
|
`whenry/fedora-jboss:v2.1`, use the following:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker build -t whenry/fedora-jboss:latest -t whenry/fedora-jboss:v2.1 .
|
||||||
|
```
|
||||||
|
### Specify a Dockerfile (-f)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker build -f Dockerfile.debug .
|
||||||
|
```
|
||||||
|
|
||||||
|
This will use a file called `Dockerfile.debug` for the build instructions
|
||||||
|
instead of `Dockerfile`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker build -f dockerfiles/Dockerfile.debug -t myapp_debug .
|
||||||
|
$ docker build -f dockerfiles/Dockerfile.prod -t myapp_prod .
|
||||||
|
```
|
||||||
|
|
||||||
|
The above commands will build the current build context (as specified by the
|
||||||
|
`.`) twice, once using a debug version of a `Dockerfile` and once using a
|
||||||
|
production version.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cd /home/me/myapp/some/dir/really/deep
|
||||||
|
$ docker build -f /home/me/myapp/dockerfiles/debug /home/me/myapp
|
||||||
|
$ docker build -f ../../../../dockerfiles/debug /home/me/myapp
|
||||||
|
```
|
||||||
|
|
||||||
|
These two `docker build` commands do the exact same thing. They both use the
|
||||||
|
contents of the `debug` file instead of looking for a `Dockerfile` and will use
|
||||||
|
`/home/me/myapp` as the root of the build context. Note that `debug` is in the
|
||||||
|
directory structure of the build context, regardless of how you refer to it on
|
||||||
|
the command line.
|
||||||
|
|
||||||
|
> **Note:**
|
||||||
|
> `docker build` will return a `no such file or directory` error if the
|
||||||
|
> file or directory does not exist in the uploaded context. This may
|
||||||
|
> happen if there is no context, or if you specify a file that is
|
||||||
|
> elsewhere on the Host system. The context is limited to the current
|
||||||
|
> directory (and its children) for security reasons, and to ensure
|
||||||
|
> repeatable builds on remote Docker hosts. This is also the reason why
|
||||||
|
> `ADD ../file` will not work.
|
||||||
|
|
||||||
|
### Use a custom parent cgroup (--cgroup-parent)
|
||||||
|
|
||||||
|
When `docker build` is run with the `--cgroup-parent` option the containers
|
||||||
|
used in the build will be run with the [corresponding `docker run`
|
||||||
|
flag](../run.md#specifying-custom-cgroups).
|
||||||
|
|
||||||
|
### Set ulimits in container (--ulimit)
|
||||||
|
|
||||||
|
Using the `--ulimit` option with `docker build` will cause each build step's
|
||||||
|
container to be started using those [`--ulimit`
|
||||||
|
flag values](./run.md#set-ulimits-in-container-ulimit).
|
||||||
|
|
||||||
|
### Set build-time variables (--build-arg)
|
||||||
|
|
||||||
|
You can use `ENV` instructions in a Dockerfile to define variable
|
||||||
|
values. These values persist in the built image. However, often
|
||||||
|
persistence is not what you want. Users want to specify variables differently
|
||||||
|
depending on which host they build an image on.
|
||||||
|
|
||||||
|
A good example is `http_proxy` or source versions for pulling intermediate
|
||||||
|
files. The `ARG` instruction lets Dockerfile authors define values that users
|
||||||
|
can set at build-time using the `--build-arg` flag:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker build --build-arg HTTP_PROXY=http://10.20.30.2:1234 .
|
||||||
|
```
|
||||||
|
|
||||||
|
This flag allows you to pass the build-time variables that are
|
||||||
|
accessed like regular environment variables in the `RUN` instruction of the
|
||||||
|
Dockerfile. Also, these values don't persist in the intermediate or final images
|
||||||
|
like `ENV` values do.
|
||||||
|
|
||||||
|
Using this flag will not alter the output you see when the `ARG` lines from the
|
||||||
|
Dockerfile are echoed during the build process.
|
||||||
|
|
||||||
|
For detailed information on using `ARG` and `ENV` instructions, see the
|
||||||
|
[Dockerfile reference](../builder.md).
|
||||||
|
|
||||||
|
### Optional security options (--security-opt)
|
||||||
|
|
||||||
|
This flag is only supported on a daemon running on Windows, and only supports
|
||||||
|
the `credentialspec` option. The `credentialspec` must be in the format
|
||||||
|
`file://spec.txt` or `registry://keyname`.
|
||||||
|
|
||||||
|
### Specify isolation technology for container (--isolation)
|
||||||
|
|
||||||
|
This option is useful in situations where you are running Docker containers on
|
||||||
|
Windows. The `--isolation=<value>` option sets a container's isolation
|
||||||
|
technology. On Linux, the only supported is the `default` option which uses
|
||||||
|
Linux namespaces. On Microsoft Windows, you can specify these values:
|
||||||
|
|
||||||
|
|
||||||
|
| Value | Description |
|
||||||
|
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| `default` | Use the value specified by the Docker daemon's `--exec-opt` . If the `daemon` does not specify an isolation technology, Microsoft Windows uses `process` as its default value. |
|
||||||
|
| `process` | Namespace isolation only. |
|
||||||
|
| `hyperv` | Hyper-V hypervisor partition-based isolation. |
|
||||||
|
|
||||||
|
Specifying the `--isolation` flag without a value is the same as setting `--isolation="default"`.
|
||||||
|
|
||||||
|
|
||||||
|
### Squash an image's layers (--squash) **Experimental Only**
|
||||||
|
|
||||||
|
Once the image is built, squash the new layers into a new image with a single
|
||||||
|
new layer. Squashing does not destroy any existing image, rather it creates a new
|
||||||
|
image with the content of the squashed layers. This effectively makes it look
|
||||||
|
like all `Dockerfile` commands were created with a single layer. The build
|
||||||
|
cache is preserved with this method.
|
||||||
|
|
||||||
|
**Note**: using this option means the new image will not be able to take
|
||||||
|
advantage of layer sharing with other images and may use significantly more
|
||||||
|
space.
|
||||||
|
|
||||||
|
**Note**: using this option you may see significantly more space used due to
|
||||||
|
storing two copies of the image, one for the build cache with all the cache
|
||||||
|
layers in tact, and one for the squashed version.
|
||||||
|
|
||||||
|
|
|
@ -12,3 +12,4 @@ clink:
|
||||||
- docker_checkpoint_create.yaml
|
- docker_checkpoint_create.yaml
|
||||||
- docker_checkpoint_ls.yaml
|
- docker_checkpoint_ls.yaml
|
||||||
- docker_checkpoint_rm.yaml
|
- docker_checkpoint_rm.yaml
|
||||||
|
|
||||||
|
|
|
@ -10,3 +10,4 @@ options:
|
||||||
- option: leave-running
|
- option: leave-running
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Leave the container running after checkpoint
|
description: Leave the container running after checkpoint
|
||||||
|
|
||||||
|
|
|
@ -8,3 +8,4 @@ plink: docker_checkpoint.yaml
|
||||||
options:
|
options:
|
||||||
- option: checkpoint-dir
|
- option: checkpoint-dir
|
||||||
description: Use a custom checkpoint storage directory
|
description: Use a custom checkpoint storage directory
|
||||||
|
|
||||||
|
|
|
@ -8,3 +8,4 @@ plink: docker_checkpoint.yaml
|
||||||
options:
|
options:
|
||||||
- option: checkpoint-dir
|
- option: checkpoint-dir
|
||||||
description: Use a custom checkpoint storage directory
|
description: Use a custom checkpoint storage directory
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,23 @@
|
||||||
command: docker commit
|
command: docker commit
|
||||||
short: Create a new image from a container's changes
|
short: Create a new image from a container's changes
|
||||||
long: |
|
long: |-
|
||||||
Alias for `docker container commit`.
|
It can be useful to commit a container's file changes or settings into a new
|
||||||
|
image. This allows you debug a container by running an interactive shell, or to
|
||||||
|
export a working dataset to another server. Generally, it is better to use
|
||||||
|
Dockerfiles to manage your images in a documented and maintainable way.
|
||||||
|
[Read more about valid image names and tags](tag.md).
|
||||||
|
|
||||||
|
The commit operation will not include any data contained in
|
||||||
|
volumes mounted inside the container.
|
||||||
|
|
||||||
|
By default, the container being committed and its processes will be paused
|
||||||
|
while the image is committed. This reduces the likelihood of encountering data
|
||||||
|
corruption during the process of creating the commit. If this behavior is
|
||||||
|
undesired, set the `--pause` option to false.
|
||||||
|
|
||||||
|
The `--change` option will apply `Dockerfile` instructions to the image that is
|
||||||
|
created. Supported `Dockerfile` instructions:
|
||||||
|
`CMD`|`ENTRYPOINT`|`ENV`|`EXPOSE`|`LABEL`|`ONBUILD`|`USER`|`VOLUME`|`WORKDIR`
|
||||||
usage: docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
|
usage: docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -20,3 +36,72 @@ options:
|
||||||
shorthand: p
|
shorthand: p
|
||||||
default_value: "true"
|
default_value: "true"
|
||||||
description: Pause container during commit
|
description: Pause container during commit
|
||||||
|
example: |-
|
||||||
|
### Commit a container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
|
||||||
|
197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
|
||||||
|
|
||||||
|
$ docker commit c3f279d17e0a svendowideit/testimage:version3
|
||||||
|
|
||||||
|
f5283438590d
|
||||||
|
|
||||||
|
$ docker images
|
||||||
|
|
||||||
|
REPOSITORY TAG ID CREATED SIZE
|
||||||
|
svendowideit/testimage version3 f5283438590d 16 seconds ago 335.7 MB
|
||||||
|
```
|
||||||
|
|
||||||
|
### Commit a container with new configurations
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{% raw %}
|
||||||
|
$ docker ps
|
||||||
|
|
||||||
|
ICONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
|
||||||
|
197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
|
||||||
|
|
||||||
|
$ docker inspect -f "{{ .Config.Env }}" c3f279d17e0a
|
||||||
|
|
||||||
|
[HOME=/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin]
|
||||||
|
|
||||||
|
$ docker commit --change "ENV DEBUG true" c3f279d17e0a svendowideit/testimage:version3
|
||||||
|
|
||||||
|
f5283438590d
|
||||||
|
|
||||||
|
$ docker inspect -f "{{ .Config.Env }}" f5283438590d
|
||||||
|
|
||||||
|
[HOME=/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin DEBUG=true]
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Commit a container with new `CMD` and `EXPOSE` instructions
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
|
||||||
|
197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
|
||||||
|
|
||||||
|
$ docker commit --change='CMD ["apachectl", "-DFOREGROUND"]' -c "EXPOSE 80" c3f279d17e0a svendowideit/testimage:version4
|
||||||
|
|
||||||
|
f5283438590d
|
||||||
|
|
||||||
|
$ docker run -d svendowideit/testimage:version4
|
||||||
|
|
||||||
|
89373736e2e7f00bc149bd783073ac43d0507da250e999f3f1036e0db60817c0
|
||||||
|
|
||||||
|
$ docker ps
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
89373736e2e7 testimage:version4 "apachectl -DFOREGROU" 3 seconds ago Up 2 seconds 80/tcp distracted_fermat
|
||||||
|
c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
|
||||||
|
197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -56,3 +56,4 @@ clink:
|
||||||
- docker_container_unpause.yaml
|
- docker_container_unpause.yaml
|
||||||
- docker_container_update.yaml
|
- docker_container_update.yaml
|
||||||
- docker_container_wait.yaml
|
- docker_container_wait.yaml
|
||||||
|
|
||||||
|
|
|
@ -1,72 +1,6 @@
|
||||||
command: docker container attach
|
command: docker container attach
|
||||||
short: Attach to a running container
|
short: Attach to a running container
|
||||||
long: |
|
long: Attach to a running container
|
||||||
The **docker attach** command allows you to attach to a running container using
|
|
||||||
the container's ID or name, either to view its ongoing output or to control it
|
|
||||||
interactively. You can attach to the same contained process multiple times
|
|
||||||
simultaneously, screen sharing style, or quickly view the progress of your
|
|
||||||
detached process.
|
|
||||||
|
|
||||||
To stop a container, use `CTRL-c`. This key sequence sends `SIGKILL` to the
|
|
||||||
container. You can detach from the container (and leave it running) using a
|
|
||||||
configurable key sequence. The default sequence is `CTRL-p CTRL-q`. You
|
|
||||||
configure the key sequence using the **--detach-keys** option or a configuration
|
|
||||||
file. See **config-json(5)** for documentation on using a configuration file.
|
|
||||||
|
|
||||||
It is forbidden to redirect the standard input of a `docker attach` command while
|
|
||||||
attaching to a tty-enabled container (i.e.: launched with `-t`).
|
|
||||||
|
|
||||||
# Override the detach sequence
|
|
||||||
|
|
||||||
If you want, you can configure an override the Docker key sequence for detach.
|
|
||||||
This is useful if the Docker default sequence conflicts with key sequence you
|
|
||||||
use for other applications. There are two ways to define your own detach key
|
|
||||||
sequence, as a per-container override or as a configuration property on your
|
|
||||||
entire configuration.
|
|
||||||
|
|
||||||
To override the sequence for an individual container, use the
|
|
||||||
`--detach-keys="<sequence>"` flag with the `docker attach` command. The format of
|
|
||||||
the `<sequence>` is either a letter [a-Z], or the `ctrl-` combined with any of
|
|
||||||
the following:
|
|
||||||
|
|
||||||
* `a-z` (a single lowercase alpha character )
|
|
||||||
* `@` (at sign)
|
|
||||||
* `[` (left bracket)
|
|
||||||
* `\\` (two backward slashes)
|
|
||||||
* `_` (underscore)
|
|
||||||
* `^` (caret)
|
|
||||||
|
|
||||||
These `a`, `ctrl-a`, `X`, or `ctrl-\\` values are all examples of valid key
|
|
||||||
sequences. To configure a different configuration default key sequence for all
|
|
||||||
containers, see **docker(1)**.
|
|
||||||
|
|
||||||
# EXAMPLES
|
|
||||||
|
|
||||||
## Attaching to a container
|
|
||||||
|
|
||||||
In this example the top command is run inside a container, from an image called
|
|
||||||
fedora, in detached mode. The ID from the container is passed into the **docker
|
|
||||||
attach** command:
|
|
||||||
|
|
||||||
# ID=$(sudo docker run -d fedora /usr/bin/top -b)
|
|
||||||
# sudo docker attach $ID
|
|
||||||
top - 02:05:52 up 3:05, 0 users, load average: 0.01, 0.02, 0.05
|
|
||||||
Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
|
|
||||||
Cpu(s): 0.1%!u(MISSING)s, 0.2%!s(MISSING)y, 0.0%!n(MISSING)i, 99.7%!i(MISSING)d, 0.0%!w(MISSING)a, 0.0%!h(MISSING)i, 0.0%!s(MISSING)i, 0.0%!s(MISSING)t
|
|
||||||
Mem: 373572k total, 355560k used, 18012k free, 27872k buffers
|
|
||||||
Swap: 786428k total, 0k used, 786428k free, 221740k cached
|
|
||||||
|
|
||||||
PID USER PR NI VIRT RES SHR S %!C(MISSING)PU %!M(MISSING)EM TIME+ COMMAND
|
|
||||||
1 root 20 0 17200 1116 912 R 0 0.3 0:00.03 top
|
|
||||||
|
|
||||||
top - 02:05:55 up 3:05, 0 users, load average: 0.01, 0.02, 0.05
|
|
||||||
Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
|
|
||||||
Cpu(s): 0.0%!u(MISSING)s, 0.2%!s(MISSING)y, 0.0%!n(MISSING)i, 99.8%!i(MISSING)d, 0.0%!w(MISSING)a, 0.0%!h(MISSING)i, 0.0%!s(MISSING)i, 0.0%!s(MISSING)t
|
|
||||||
Mem: 373572k total, 355244k used, 18328k free, 27872k buffers
|
|
||||||
Swap: 786428k total, 0k used, 786428k free, 221776k cached
|
|
||||||
|
|
||||||
PID USER PR NI VIRT RES SHR S %!C(MISSING)PU %!M(MISSING)EM TIME+ COMMAND
|
|
||||||
1 root 20 0 17208 1144 932 R 0 0.3 0:00.03 top
|
|
||||||
usage: docker container attach [OPTIONS] CONTAINER
|
usage: docker container attach [OPTIONS] CONTAINER
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
@ -79,3 +13,4 @@ options:
|
||||||
- option: sig-proxy
|
- option: sig-proxy
|
||||||
default_value: "true"
|
default_value: "true"
|
||||||
description: Proxy all received signals to the process
|
description: Proxy all received signals to the process
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,6 @@
|
||||||
command: docker container commit
|
command: docker container commit
|
||||||
short: Create a new image from a container's changes
|
short: Create a new image from a container's changes
|
||||||
long: "Create a new image from an existing container specified by name or\ncontainer
|
long: Create a new image from a container's changes
|
||||||
ID. The new image will contain the contents of the\ncontainer filesystem, *excluding*
|
|
||||||
any data volumes. Refer to **docker-tag(1)**\nfor more information about valid image
|
|
||||||
and tag names.\n\nWhile the `docker commit` command is a convenient way of extending
|
|
||||||
an\nexisting image, you should prefer the use of a Dockerfile and `docker\nbuild`
|
|
||||||
for generating images that you intend to share with other\npeople.\n\n# EXAMPLES\n\n##
|
|
||||||
Creating a new image from an existing container\nAn existing Fedora based container
|
|
||||||
has had Apache installed while running\nin interactive mode with the bash shell.
|
|
||||||
Apache is also running. To\ncreate a new image run `docker ps` to find the container's
|
|
||||||
ID and then run:\n\n # docker commit -m=\"Added Apache to Fedora base image\"
|
|
||||||
\\\n -a=\"A D Ministrator\" 98bd7fc99854 fedora/fedora_httpd:20\n\nNote that
|
|
||||||
only a-z0-9-_. are allowed when naming images from an \nexisting container.\n\n##
|
|
||||||
Apply specified Dockerfile instructions while committing the image\nIf an existing
|
|
||||||
container was created without the DEBUG environment\nvariable set to \"true\", you
|
|
||||||
can create a new image based on that\ncontainer by first getting the container's
|
|
||||||
ID with `docker ps` and\nthen running:\n\n # docker container commit -c=\"ENV
|
|
||||||
DEBUG true\" 98bd7fc99854 debug-image\n"
|
|
||||||
usage: docker container commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
|
usage: docker container commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
@ -35,3 +19,4 @@ options:
|
||||||
shorthand: p
|
shorthand: p
|
||||||
default_value: "true"
|
default_value: "true"
|
||||||
description: Pause container during commit
|
description: Pause container during commit
|
||||||
|
|
||||||
|
|
|
@ -1,94 +1,12 @@
|
||||||
command: docker container cp
|
command: docker container cp
|
||||||
short: Copy files/folders between a container and the local filesystem
|
short: Copy files/folders between a container and the local filesystem
|
||||||
long: "The `docker container cp` utility copies the contents of `SRC_PATH` to the
|
long: |-
|
||||||
`DEST_PATH`.\nYou can copy from the container's file system to the local machine
|
Copy files/folders between a container and the local filesystem
|
||||||
or the\nreverse, from the local filesystem to the container. If `-` is specified
|
|
||||||
for\neither the `SRC_PATH` or `DEST_PATH`, you can also stream a tar archive from\n`STDIN`
|
Use '-' as the source to read a tar archive from stdin
|
||||||
or to `STDOUT`. The `CONTAINER` can be a running or stopped container.\nThe `SRC_PATH`
|
and extract it to a directory destination in a container.
|
||||||
or `DEST_PATH` can be a file or directory.\n\nThe `docker container cp` command
|
Use '-' as the destination to stream a tar archive of a
|
||||||
assumes container paths are relative to the container's \n`/` (root) directory.
|
container source to stdout.
|
||||||
This means supplying the initial forward slash is optional; \nThe command sees `compassionate_darwin:/tmp/foo/myfile.txt`
|
|
||||||
and\n`compassionate_darwin:tmp/foo/myfile.txt` as identical. Local machine paths
|
|
||||||
can\nbe an absolute or relative value. The command interprets a local machine's\nrelative
|
|
||||||
paths as relative to the current working directory where `docker container cp` is\nrun.\n\nThe
|
|
||||||
`cp` command behaves like the Unix `cp -a` command in that directories are\ncopied
|
|
||||||
recursively with permissions preserved if possible. Ownership is set to\nthe user
|
|
||||||
and primary group at the destination. For example, files copied to a\ncontainer
|
|
||||||
are created with `UID:GID` of the root user. Files copied to the local\nmachine
|
|
||||||
are created with the `UID:GID` of the user which invoked the `docker container cp`\ncommand.
|
|
||||||
\ If you specify the `-L` option, `docker container cp` follows any symbolic link\nin
|
|
||||||
the `SRC_PATH`. `docker container cp` does *not* create parent directories for\n`DEST_PATH`
|
|
||||||
if they do not exist.\n\nAssuming a path separator of `/`, a first argument of `SRC_PATH`
|
|
||||||
and second\nargument of `DEST_PATH`, the behavior is as follows:\n\n- `SRC_PATH`
|
|
||||||
specifies a file\n - `DEST_PATH` does not exist\n - the file is saved
|
|
||||||
to a file created at `DEST_PATH`\n - `DEST_PATH` does not exist and ends with
|
|
||||||
`/`\n - Error condition: the destination directory must exist.\n - `DEST_PATH`
|
|
||||||
exists and is a file\n - the destination is overwritten with the source file's
|
|
||||||
contents\n - `DEST_PATH` exists and is a directory\n - the file is copied
|
|
||||||
into this directory using the basename from\n `SRC_PATH`\n- `SRC_PATH`
|
|
||||||
specifies a directory\n - `DEST_PATH` does not exist\n - `DEST_PATH` is
|
|
||||||
created as a directory and the *contents* of the source\n directory are
|
|
||||||
copied into this directory\n - `DEST_PATH` exists and is a file\n - Error
|
|
||||||
condition: cannot copy a directory to a file\n - `DEST_PATH` exists and is a
|
|
||||||
directory\n - `SRC_PATH` does not end with `/.` (that is: _slash_ followed
|
|
||||||
by _dot_)\n - the source directory is copied into this directory\n -
|
|
||||||
`SRC_PATH` does end with `/.` (that is: _slash_ followed by _dot_)\n -
|
|
||||||
the *content* of the source directory is copied into this\n directory\n\nThe
|
|
||||||
command requires `SRC_PATH` and `DEST_PATH` to exist according to the above\nrules.
|
|
||||||
If `SRC_PATH` is local and is a symbolic link, the symbolic link, not\nthe target,
|
|
||||||
is copied by default. To copy the link target and not the link, \nspecify the `-L`
|
|
||||||
option.\n\nA colon (`:`) is used as a delimiter between `CONTAINER` and its path.
|
|
||||||
You can\nalso use `:` when specifying paths to a `SRC_PATH` or `DEST_PATH` on a
|
|
||||||
local\nmachine, for example `file:name.txt`. If you use a `:` in a local machine
|
|
||||||
path,\nyou must be explicit with a relative or absolute path, for example:\n\n `/path/to/file:name.txt`
|
|
||||||
or `./file:name.txt`\n\nIt is not possible to copy certain system files such as
|
|
||||||
resources under\n`/proc`, `/sys`, `/dev`, tmpfs, and mounts created by the user
|
|
||||||
in the container.\nHowever, you can still copy such files by manually running `tar`
|
|
||||||
in `docker exec`.\nFor example (consider `SRC_PATH` and `DEST_PATH` are directories):\n\n
|
|
||||||
\ $ docker exec foo tar Ccf $(dirname SRC_PATH) - $(basename SRC_PATH) | tar Cxf
|
|
||||||
DEST_PATH -\n\nor\n\n $ tar Ccf $(dirname SRC_PATH) - $(basename SRC_PATH) |
|
|
||||||
docker exec -i foo tar Cxf DEST_PATH -\n\n\nUsing `-` as the `SRC_PATH` streams
|
|
||||||
the contents of `STDIN` as a tar archive.\nThe command extracts the content of the
|
|
||||||
tar to the `DEST_PATH` in container's\nfilesystem. In this case, `DEST_PATH` must
|
|
||||||
specify a directory. Using `-` as\nthe `DEST_PATH` streams the contents of the resource
|
|
||||||
as a tar archive to `STDOUT`.\n\n# EXAMPLES\n\nSuppose a container has finished
|
|
||||||
producing some output as a file it saves\nto somewhere in its filesystem. This could
|
|
||||||
be the output of a build job or\nsome other computation. You can copy these outputs
|
|
||||||
from the container to a\nlocation on your local host.\n\nIf you want to copy the
|
|
||||||
`/tmp/foo` directory from a container to the\nexisting `/tmp` directory on your
|
|
||||||
host. If you run `docker container cp` in your `~`\n(home) directory on the local
|
|
||||||
host:\n\n $ docker container cp compassionate_darwin:tmp/foo /tmp\n\nDocker creates
|
|
||||||
a `/tmp/foo` directory on your host. Alternatively, you can omit\nthe leading slash
|
|
||||||
in the command. If you execute this command from your home\ndirectory:\n\n $
|
|
||||||
docker container cp compassionate_darwin:tmp/foo tmp\n\nIf `~/tmp` does not exist,
|
|
||||||
Docker will create it and copy the contents of\n`/tmp/foo` from the container into
|
|
||||||
this new directory. If `~/tmp` already\nexists as a directory, then Docker will
|
|
||||||
copy the contents of `/tmp/foo` from\nthe container into a directory at `~/tmp/foo`.\n\nWhen
|
|
||||||
copying a single file to an existing `LOCALPATH`, the `docker container cp` command\nwill
|
|
||||||
either overwrite the contents of `LOCALPATH` if it is a file or place it\ninto `LOCALPATH`
|
|
||||||
if it is a directory, overwriting an existing file of the same\nname if one exists.
|
|
||||||
For example, this command:\n\n $ docker container cp sharp_ptolemy:/tmp/foo/myfile.txt
|
|
||||||
/test\n\nIf `/test` does not exist on the local machine, it will be created as a
|
|
||||||
file\nwith the contents of `/tmp/foo/myfile.txt` from the container. If `/test`\nexists
|
|
||||||
as a file, it will be overwritten. Lastly, if `/test` exists as a\ndirectory, the
|
|
||||||
file will be copied to `/test/myfile.txt`.\n\nNext, suppose you want to copy a file
|
|
||||||
or folder into a container. For example,\nthis could be a configuration file or
|
|
||||||
some other input to a long running\ncomputation that you would like to place into
|
|
||||||
a created container before it\nstarts. This is useful because it does not require
|
|
||||||
the configuration file or\nother input to exist in the container image.\n\nIf you
|
|
||||||
have a file, `config.yml`, in the current directory on your local host\nand wish
|
|
||||||
to copy it to an existing directory at `/etc/my-app.d` in a container,\nthis command
|
|
||||||
can be used:\n\n $ docker container cp config.yml myappcontainer:/etc/my-app.d\n\nIf
|
|
||||||
you have several files in a local directory `/config` which you need to copy\nto
|
|
||||||
a directory `/etc/my-app.d` in a container:\n\n $ docker container cp /config/.
|
|
||||||
myappcontainer:/etc/my-app.d\n\nThe above command will copy the contents of the
|
|
||||||
local `/config` directory into\nthe directory `/etc/my-app.d` in the container.\n\nFinally,
|
|
||||||
if you want to copy a symbolic link into a container, you typically\nwant to copy
|
|
||||||
the linked target and not the link itself. To copy the target, use\nthe `-L` option,
|
|
||||||
for example:\n\n $ ln -s /tmp/somefile /tmp/somefile.ln\n $ docker container
|
|
||||||
cp -L /tmp/somefile.ln myappcontainer:/tmp/\n\nThis command copies content of the
|
|
||||||
local `/tmp/somefile` into the file\n`/tmp/somefile.ln` in the container. Without
|
|
||||||
`-L` option, the `/tmp/somefile.ln`\npreserves its symbolic link but not its content.\n"
|
|
||||||
usage: "docker container cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-\n\tdocker cp
|
usage: "docker container cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-\n\tdocker cp
|
||||||
[OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH"
|
[OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH"
|
||||||
pname: docker container
|
pname: docker container
|
||||||
|
@ -98,3 +16,4 @@ options:
|
||||||
shorthand: L
|
shorthand: L
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Always follow symbol link in SRC_PATH
|
description: Always follow symbol link in SRC_PATH
|
||||||
|
|
||||||
|
|
|
@ -1,73 +1,6 @@
|
||||||
command: docker container create
|
command: docker container create
|
||||||
short: Create a new container
|
short: Create a new container
|
||||||
long: "Creates a writeable container layer over the specified image and prepares it
|
long: Create a new container
|
||||||
for\nrunning the specified command. The container ID is then printed to STDOUT.
|
|
||||||
This\nis similar to **docker run -d** except the container is never started. You
|
|
||||||
can \nthen use the **docker start <container_id>** command to start the container
|
|
||||||
at\nany point.\n\nThe initial status of the container created with **docker create**
|
|
||||||
is 'created'.\n\n# OPTIONS \n\nThe `CONTAINER-DIR` must be an absolute path such
|
|
||||||
as `/src/docs`. The `HOST-DIR`\ncan be an absolute path or a `name` value. A `name`
|
|
||||||
value must start with an\nalphanumeric character, followed by `a-z0-9`, `_` (underscore),
|
|
||||||
`.` (period) or\n`-` (hyphen). An absolute path starts with a `/` (forward slash).\n\nIf
|
|
||||||
you supply a `HOST-DIR` that is an absolute path, Docker bind-mounts to the\npath
|
|
||||||
you specify. If you supply a `name`, Docker creates a named volume by that\n`name`.
|
|
||||||
For example, you can specify either `/foo` or `foo` for a `HOST-DIR`\nvalue. If
|
|
||||||
you supply the `/foo` value, Docker creates a bind-mount. If you\nsupply the `foo`
|
|
||||||
specification, Docker creates a named volume.\n\nYou can specify multiple **-v**
|
|
||||||
options to mount one or more mounts to a\ncontainer. To use these same mounts in
|
|
||||||
other containers, specify the\n**--volumes-from** option also.\n\nYou can add `:ro`
|
|
||||||
or `:rw` suffix to a volume to mount it read-only or\nread-write mode, respectively.
|
|
||||||
By default, the volumes are mounted read-write.\nSee examples.\n\nLabeling systems
|
|
||||||
like SELinux require that proper labels are placed on volume\ncontent mounted into
|
|
||||||
a container. Without a label, the security system might\nprevent the processes running
|
|
||||||
inside the container from using the content. By\ndefault, Docker does not change
|
|
||||||
the labels set by the OS.\n\nTo change a label in the container context, you can
|
|
||||||
add either of two suffixes\n`:z` or `:Z` to the volume mount. These suffixes tell
|
|
||||||
Docker to relabel file\nobjects on the shared volumes. The `z` option tells Docker
|
|
||||||
that two containers\nshare the volume content. As a result, Docker labels the content
|
|
||||||
with a shared\ncontent label. Shared volume labels allow all containers to read/write
|
|
||||||
content.\nThe `Z` option tells Docker to label the content with a private unshared
|
|
||||||
label.\nOnly the current container can use a private volume.\n\nBy default bind
|
|
||||||
mounted volumes are `private`. That means any mounts done\ninside container will
|
|
||||||
not be visible on host and vice-a-versa. One can change\nthis behavior by specifying
|
|
||||||
a volume mount propagation property. Making a\nvolume `shared` mounts done under
|
|
||||||
that volume inside container will be\nvisible on host and vice-a-versa. Making a
|
|
||||||
volume `slave` enables only one\nway mount propagation and that is mounts done on
|
|
||||||
host under that volume\nwill be visible inside container but not the other way around.\n\nTo
|
|
||||||
control mount propagation property of volume one can use `:[r]shared`,\n`:[r]slave`
|
|
||||||
or `:[r]private` propagation flag. Propagation property can\nbe specified only for
|
|
||||||
bind mounted volumes and not for internal volumes or\nnamed volumes. For mount propagation
|
|
||||||
to work source mount point (mount point\nwhere source dir is mounted on) has to
|
|
||||||
have right propagation properties. For\nshared volumes, source mount point has to
|
|
||||||
be shared. And for slave volumes,\nsource mount has to be either shared or slave.\n\nUse
|
|
||||||
`df <source-dir>` to figure out the source mount and then use\n`findmnt -o TARGET,PROPAGATION
|
|
||||||
<source-mount-dir>` to figure out propagation\nproperties of source mount. If `findmnt`
|
|
||||||
utility is not available, then one\ncan look at mount entry for source mount point
|
|
||||||
in `/proc/self/mountinfo`. Look\nat `optional fields` and see if any propagaion
|
|
||||||
properties are specified.\n`shared:X` means mount is `shared`, `master:X` means
|
|
||||||
mount is `slave` and if\nnothing is there that means mount is `private`.\n\nTo change
|
|
||||||
propagation properties of a mount point use `mount` command. For\nexample, if one
|
|
||||||
wants to bind mount source directory `/foo` one can do\n`mount --bind /foo /foo`
|
|
||||||
and `mount --make-private --make-shared /foo`. This\nwill convert /foo into a `shared`
|
|
||||||
mount point. Alternatively one can directly\nchange propagation properties of source
|
|
||||||
mount. Say `/` is source mount for\n`/foo`, then use `mount --make-shared /` to
|
|
||||||
convert `/` into a `shared` mount.\n\n> **Note**:\n> When using systemd to manage
|
|
||||||
the Docker daemon's start and stop, in the systemd\n> unit file there is an option
|
|
||||||
to control mount propagation for the Docker daemon\n> itself, called `MountFlags`.
|
|
||||||
The value of this setting may cause Docker to not\n> see mount propagation changes
|
|
||||||
made on the mount point. For example, if this value\n> is `slave`, you may not be
|
|
||||||
able to use the `shared` or `rshared` propagation on\n> a volume.\n\n\nTo disable
|
|
||||||
automatic copying of data from the container path to the volume, use\nthe `nocopy`
|
|
||||||
flag. The `nocopy` flag can be set on bind mounts and named volumes.\n\n# EXAMPLES\n\n##
|
|
||||||
Specify isolation technology for container (--isolation)\n\nThis option is useful
|
|
||||||
in situations where you are running Docker containers on\nWindows. The `--isolation=<value>`
|
|
||||||
option sets a container's isolation\ntechnology. On Linux, the only supported is
|
|
||||||
the `default` option which uses\nLinux namespaces. On Microsoft Windows, you can
|
|
||||||
specify these values:\n\n* `default`: Use the value specified by the Docker daemon's
|
|
||||||
`--exec-opt` . If the `daemon` does not specify an isolation technology, Microsoft
|
|
||||||
Windows uses `process` as its default value.\n* `process`: Namespace isolation only.\n*
|
|
||||||
`hyperv`: Hyper-V hypervisor partition-based isolation.\n\nSpecifying the `--isolation`
|
|
||||||
flag without a value is the same as setting `--isolation=\"default\"`.\n"
|
|
||||||
usage: docker container create [OPTIONS] IMAGE [COMMAND] [ARG...]
|
usage: docker container create [OPTIONS] IMAGE [COMMAND] [ARG...]
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
@ -130,6 +63,9 @@ options:
|
||||||
- option: device
|
- option: device
|
||||||
default_value: '[]'
|
default_value: '[]'
|
||||||
description: Add a host device to the container
|
description: Add a host device to the container
|
||||||
|
- option: device-cgroup-rule
|
||||||
|
default_value: '[]'
|
||||||
|
description: Add a rule to the cgroup allowed devices list
|
||||||
- option: device-read-bps
|
- option: device-read-bps
|
||||||
default_value: '[]'
|
default_value: '[]'
|
||||||
description: Limit read rate (bytes per second) from a device
|
description: Limit read rate (bytes per second) from a device
|
||||||
|
@ -175,13 +111,13 @@ options:
|
||||||
- option: health-cmd
|
- option: health-cmd
|
||||||
description: Command to run to check health
|
description: Command to run to check health
|
||||||
- option: health-interval
|
- option: health-interval
|
||||||
default_value: "0"
|
default_value: 0s
|
||||||
description: Time between running the check (ns|us|ms|s|m|h) (default 0s)
|
description: Time between running the check (ns|us|ms|s|m|h) (default 0s)
|
||||||
- option: health-retries
|
- option: health-retries
|
||||||
default_value: "0"
|
default_value: "0"
|
||||||
description: Consecutive failures needed to report unhealthy
|
description: Consecutive failures needed to report unhealthy
|
||||||
- option: health-timeout
|
- option: health-timeout
|
||||||
default_value: "0"
|
default_value: 0s
|
||||||
description: |
|
description: |
|
||||||
Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)
|
Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)
|
||||||
- option: help
|
- option: help
|
||||||
|
@ -301,7 +237,8 @@ options:
|
||||||
default_value: '[]'
|
default_value: '[]'
|
||||||
description: Security Options
|
description: Security Options
|
||||||
- option: shm-size
|
- option: shm-size
|
||||||
description: Size of /dev/shm, default value is 64MB
|
default_value: "0"
|
||||||
|
description: Size of /dev/shm
|
||||||
- option: stop-signal
|
- option: stop-signal
|
||||||
default_value: SIGTERM
|
default_value: SIGTERM
|
||||||
description: Signal to stop a container, SIGTERM by default
|
description: Signal to stop a container, SIGTERM by default
|
||||||
|
@ -343,3 +280,4 @@ options:
|
||||||
- option: workdir
|
- option: workdir
|
||||||
shorthand: w
|
shorthand: w
|
||||||
description: Working directory inside the container
|
description: Working directory inside the container
|
||||||
|
|
||||||
|
|
|
@ -1,45 +1,7 @@
|
||||||
command: docker container diff
|
command: docker container diff
|
||||||
short: Inspect changes to files or directories on a container's filesystem
|
short: Inspect changes to files or directories on a container's filesystem
|
||||||
long: |
|
long: Inspect changes to files or directories on a container's filesystem
|
||||||
List the changed files and directories in a container᾿s filesystem since the
|
|
||||||
container was created. Three different types of change are tracked:
|
|
||||||
|
|
||||||
| Symbol | Description |
|
|
||||||
|--------|---------------------------------|
|
|
||||||
| `A` | A file or directory was added |
|
|
||||||
| `D` | A file or directory was deleted |
|
|
||||||
| `C` | A file or directory was changed |
|
|
||||||
|
|
||||||
You can use the full or shortened container ID or the container name set using
|
|
||||||
**docker run --name** option.
|
|
||||||
|
|
||||||
# EXAMPLES
|
|
||||||
|
|
||||||
Inspect the changes to an `nginx` container:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ docker diff 1fdfd1f54c1b
|
|
||||||
|
|
||||||
C /dev
|
|
||||||
C /dev/console
|
|
||||||
C /dev/core
|
|
||||||
C /dev/stdout
|
|
||||||
C /dev/fd
|
|
||||||
C /dev/ptmx
|
|
||||||
C /dev/stderr
|
|
||||||
C /dev/stdin
|
|
||||||
C /run
|
|
||||||
A /run/nginx.pid
|
|
||||||
C /var/lib/nginx/tmp
|
|
||||||
A /var/lib/nginx/tmp/client_body
|
|
||||||
A /var/lib/nginx/tmp/fastcgi
|
|
||||||
A /var/lib/nginx/tmp/proxy
|
|
||||||
A /var/lib/nginx/tmp/scgi
|
|
||||||
A /var/lib/nginx/tmp/uwsgi
|
|
||||||
C /var/log/nginx
|
|
||||||
A /var/log/nginx/access.log
|
|
||||||
A /var/log/nginx/error.log
|
|
||||||
```
|
|
||||||
usage: docker container diff CONTAINER
|
usage: docker container diff CONTAINER
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,6 @@
|
||||||
command: docker container exec
|
command: docker container exec
|
||||||
short: Run a command in a running container
|
short: Run a command in a running container
|
||||||
long: "Run a process in a running container.\n\nThe command started using `docker
|
long: Run a command in a running container
|
||||||
exec` will only run while the container's primary\nprocess (`PID 1`) is running,
|
|
||||||
and will not be restarted if the container is restarted.\n\nIf the container is
|
|
||||||
paused, then the `docker exec` command will wait until the\ncontainer is unpaused,
|
|
||||||
and then run\n\n# CAPABILITIES\n\n`privileged` gives the process extended\n[Linux
|
|
||||||
capabilities](http://man7.org/linux/man-pages/man7/capabilities.7.html)\nwhen running
|
|
||||||
in a container. \n\nWithout this flag, the process run by `docker exec` in a running
|
|
||||||
container has\nthe same capabilities as the container, which may be limited. Set\n`--privileged`
|
|
||||||
to give all capabilities to the process.\n\n# USER\n`user` sets the username or
|
|
||||||
UID used and optionally the groupname or GID for the specified command.\n\n The
|
|
||||||
followings examples are all valid:\n --user [user | user:group | uid | uid:gid
|
|
||||||
| user:gid | uid:group ]\n\n Without this argument the command will be run as
|
|
||||||
root in the container.\n"
|
|
||||||
usage: docker container exec [OPTIONS] CONTAINER COMMAND [ARG...]
|
usage: docker container exec [OPTIONS] CONTAINER COMMAND [ARG...]
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
@ -41,3 +29,4 @@ options:
|
||||||
- option: user
|
- option: user
|
||||||
shorthand: u
|
shorthand: u
|
||||||
description: 'Username or UID (format: <name|uid>[:<group|gid>])'
|
description: 'Username or UID (format: <name|uid>[:<group|gid>])'
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,6 @@
|
||||||
command: docker container export
|
command: docker container export
|
||||||
short: Export a container's filesystem as a tar archive
|
short: Export a container's filesystem as a tar archive
|
||||||
long: |
|
long: Export a container's filesystem as a tar archive
|
||||||
Export the contents of a container's filesystem using the full or shortened
|
|
||||||
container ID or container name. The output is exported to STDOUT and can be
|
|
||||||
redirected to a tar file.
|
|
||||||
|
|
||||||
Stream to a file instead of STDOUT by using **-o**.
|
|
||||||
|
|
||||||
# EXAMPLES
|
|
||||||
Export the contents of the container called angry_bell to a tar file
|
|
||||||
called angry_bell.tar:
|
|
||||||
|
|
||||||
# docker export angry_bell > angry_bell.tar
|
|
||||||
# docker export --output=angry_bell-latest.tar angry_bell
|
|
||||||
# ls -sh angry_bell.tar
|
|
||||||
321M angry_bell.tar
|
|
||||||
# ls -sh angry_bell-latest.tar
|
|
||||||
321M angry_bell-latest.tar
|
|
||||||
|
|
||||||
# See also
|
|
||||||
**docker-import(1)** to create an empty filesystem image
|
|
||||||
and import the contents of the tarball into it, then optionally tag it.
|
|
||||||
usage: docker container export [OPTIONS] CONTAINER
|
usage: docker container export [OPTIONS] CONTAINER
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
@ -28,3 +8,4 @@ options:
|
||||||
- option: output
|
- option: output
|
||||||
shorthand: o
|
shorthand: o
|
||||||
description: Write to a file, instead of STDOUT
|
description: Write to a file, instead of STDOUT
|
||||||
|
|
||||||
|
|
|
@ -12,3 +12,4 @@ options:
|
||||||
shorthand: s
|
shorthand: s
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Display total file sizes
|
description: Display total file sizes
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
command: docker container kill
|
command: docker container kill
|
||||||
short: Kill one or more running containers
|
short: Kill one or more running containers
|
||||||
long: |
|
long: Kill one or more running containers
|
||||||
The main process inside each container specified will be sent SIGKILL,
|
|
||||||
or any signal specified with option --signal.
|
|
||||||
usage: docker container kill [OPTIONS] CONTAINER [CONTAINER...]
|
usage: docker container kill [OPTIONS] CONTAINER [CONTAINER...]
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
@ -11,3 +9,4 @@ options:
|
||||||
shorthand: s
|
shorthand: s
|
||||||
default_value: KILL
|
default_value: KILL
|
||||||
description: Signal to send to the container
|
description: Signal to send to the container
|
||||||
|
|
||||||
|
|
|
@ -1,34 +1,6 @@
|
||||||
command: docker container logs
|
command: docker container logs
|
||||||
short: Fetch the logs of a container
|
short: Fetch the logs of a container
|
||||||
long: |
|
long: Fetch the logs of a container
|
||||||
The **docker container logs** command batch-retrieves whatever logs are present for
|
|
||||||
a container at the time of execution. This does not guarantee execution
|
|
||||||
order when combined with a docker run (i.e., your run may not have generated
|
|
||||||
any logs at the time you execute docker container logs).
|
|
||||||
|
|
||||||
The **docker container logs --follow** command combines commands **docker container logs** and
|
|
||||||
**docker attach**. It will first return all logs from the beginning and
|
|
||||||
then continue streaming new output from the container's stdout and stderr.
|
|
||||||
|
|
||||||
**Warning**: This command works only for the **json-file** or **journald**
|
|
||||||
logging drivers.
|
|
||||||
|
|
||||||
The `--since` option can be Unix timestamps, date formatted timestamps, or Go
|
|
||||||
duration strings (e.g. `10m`, `1h30m`) computed relative to the client machine's
|
|
||||||
time. Supported formats for date formatted time stamps include RFC3339Nano,
|
|
||||||
RFC3339, `2006-01-02T15:04:05`, `2006-01-02T15:04:05.999999999`,
|
|
||||||
`2006-01-02Z07:00`, and `2006-01-02`. The local timezone on the client will be
|
|
||||||
used if you do not provide either a `Z` or a `+-00:00` timezone offset at the
|
|
||||||
end of the timestamp. When providing Unix timestamps enter
|
|
||||||
seconds[.nanoseconds], where seconds is the number of seconds that have elapsed
|
|
||||||
since January 1, 1970 (midnight UTC/GMT), not counting leap seconds (aka Unix
|
|
||||||
epoch or Unix time), and the optional .nanoseconds field is a fraction of a
|
|
||||||
second no more than nine digits long. You can combine the `--since` option with
|
|
||||||
either or both of the `--follow` or `--tail` options.
|
|
||||||
|
|
||||||
The `docker container logs --details` command will add on extra attributes, such as
|
|
||||||
environment variables and labels, provided to `--log-opt` when creating the
|
|
||||||
container.
|
|
||||||
usage: docker container logs [OPTIONS] CONTAINER
|
usage: docker container logs [OPTIONS] CONTAINER
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
@ -50,3 +22,4 @@ options:
|
||||||
shorthand: t
|
shorthand: t
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Show timestamps
|
description: Show timestamps
|
||||||
|
|
||||||
|
|
|
@ -1,103 +1,7 @@
|
||||||
command: docker container ls
|
command: docker container ls
|
||||||
aliases: ps, list
|
aliases: ps, list
|
||||||
short: List containers
|
short: List containers
|
||||||
long: |
|
long: List containers
|
||||||
List the containers in the local repository. By default this shows only
|
|
||||||
the running containers.
|
|
||||||
|
|
||||||
## Filters
|
|
||||||
|
|
||||||
Filter output based on these conditions:
|
|
||||||
- exited=<int> an exit code of <int>
|
|
||||||
- label=<key> or label=<key>=<value>
|
|
||||||
- status=(created|restarting|running|paused|exited|dead)
|
|
||||||
- name=<string> a container's name
|
|
||||||
- id=<ID> a container's ID
|
|
||||||
- is-task=(true|false) - containers that are a task (part of a service managed by swarm)
|
|
||||||
- before=(<container-name>|<container-id>)
|
|
||||||
- since=(<container-name>|<container-id>)
|
|
||||||
- ancestor=(<image-name>[:tag]|<image-id>|<image@digest>) - containers created from an image or a descendant.
|
|
||||||
- volume=(<volume-name>|<mount-point-destination>)
|
|
||||||
- network=(<network-name>|<network-id>) - containers connected to the provided network
|
|
||||||
- health=(starting|healthy|unhealthy|none) - filters containers based on healthcheck status
|
|
||||||
|
|
||||||
## Format
|
|
||||||
|
|
||||||
Pretty-print containers using a Go template.
|
|
||||||
Valid placeholders:
|
|
||||||
.ID - Container ID
|
|
||||||
.Image - Image ID
|
|
||||||
.Command - Quoted command
|
|
||||||
.CreatedAt - Time when the container was created.
|
|
||||||
.RunningFor - Elapsed time since the container was started.
|
|
||||||
.Ports - Exposed ports.
|
|
||||||
.Status - Container status.
|
|
||||||
.Size - Container disk size.
|
|
||||||
.Names - Container names.
|
|
||||||
.Labels - All labels assigned to the container.
|
|
||||||
.Label - Value of a specific label for this container. For example `{{.Label "com.docker.swarm.cpu"}}`
|
|
||||||
.Mounts - Names of the volumes mounted in this container.
|
|
||||||
|
|
||||||
# EXAMPLES
|
|
||||||
# Display all containers, including non-running
|
|
||||||
|
|
||||||
# docker container ls -a
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
|
||||||
a87ecb4f327c fedora:20 /bin/sh -c #(nop) MA 20 minutes ago Exit 0 desperate_brattain
|
|
||||||
01946d9d34d8 vpavlin/rhel7:latest /bin/sh -c #(nop) MA 33 minutes ago Exit 0 thirsty_bell
|
|
||||||
c1d3b0166030 acffc0358b9e /bin/sh -c yum -y up 2 weeks ago Exit 1 determined_torvalds
|
|
||||||
41d50ecd2f57 fedora:20 /bin/sh -c #(nop) MA 2 weeks ago Exit 0 drunk_pike
|
|
||||||
|
|
||||||
# Display only IDs of all containers, including non-running
|
|
||||||
|
|
||||||
# docker container ls -a -q
|
|
||||||
a87ecb4f327c
|
|
||||||
01946d9d34d8
|
|
||||||
c1d3b0166030
|
|
||||||
41d50ecd2f57
|
|
||||||
|
|
||||||
# Display only IDs of all containers that have the name `determined_torvalds`
|
|
||||||
|
|
||||||
# docker container ls -a -q --filter=name=determined_torvalds
|
|
||||||
c1d3b0166030
|
|
||||||
|
|
||||||
# Display containers with their commands
|
|
||||||
|
|
||||||
# docker container ls --format "{{.ID}}: {{.Command}}"
|
|
||||||
a87ecb4f327c: /bin/sh -c #(nop) MA
|
|
||||||
01946d9d34d8: /bin/sh -c #(nop) MA
|
|
||||||
c1d3b0166030: /bin/sh -c yum -y up
|
|
||||||
41d50ecd2f57: /bin/sh -c #(nop) MA
|
|
||||||
|
|
||||||
# Display containers with their labels in a table
|
|
||||||
|
|
||||||
# docker container ls --format "table {{.ID}}\t{{.Labels}}"
|
|
||||||
CONTAINER ID LABELS
|
|
||||||
a87ecb4f327c com.docker.swarm.node=ubuntu,com.docker.swarm.storage=ssd
|
|
||||||
01946d9d34d8
|
|
||||||
c1d3b0166030 com.docker.swarm.node=debian,com.docker.swarm.cpu=6
|
|
||||||
41d50ecd2f57 com.docker.swarm.node=fedora,com.docker.swarm.cpu=3,com.docker.swarm.storage=ssd
|
|
||||||
|
|
||||||
# Display containers with their node label in a table
|
|
||||||
|
|
||||||
# docker container ls --format 'table {{.ID}}\t{{(.Label "com.docker.swarm.node")}}'
|
|
||||||
CONTAINER ID NODE
|
|
||||||
a87ecb4f327c ubuntu
|
|
||||||
01946d9d34d8
|
|
||||||
c1d3b0166030 debian
|
|
||||||
41d50ecd2f57 fedora
|
|
||||||
|
|
||||||
# Display containers with `remote-volume` mounted
|
|
||||||
|
|
||||||
$ docker container ls --filter volume=remote-volume --format "table {{.ID}}\t{{.Mounts}}"
|
|
||||||
CONTAINER ID MOUNTS
|
|
||||||
9c3527ed70ce remote-volume
|
|
||||||
|
|
||||||
# Display containers with a volume mounted in `/data`
|
|
||||||
|
|
||||||
$ docker container ls --filter volume=/data --format "table {{.ID}}\t{{.Mounts}}"
|
|
||||||
CONTAINER ID MOUNTS
|
|
||||||
9c3527ed70ce remote-volume
|
|
||||||
usage: docker container ls [OPTIONS]
|
usage: docker container ls [OPTIONS]
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
@ -130,3 +34,4 @@ options:
|
||||||
shorthand: s
|
shorthand: s
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Display total file sizes
|
description: Display total file sizes
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,7 @@
|
||||||
command: docker container pause
|
command: docker container pause
|
||||||
short: Pause all processes within one or more containers
|
short: Pause all processes within one or more containers
|
||||||
long: |
|
long: Pause all processes within one or more containers
|
||||||
The `docker container pause` command suspends all processes in the specified containers.
|
|
||||||
On Linux, this uses the cgroups freezer. Traditionally, when suspending a process
|
|
||||||
the `SIGSTOP` signal is used, which is observable by the process being suspended.
|
|
||||||
With the cgroups freezer the process is unaware, and unable to capture,
|
|
||||||
that it is being suspended, and subsequently resumed. On Windows, only Hyper-V
|
|
||||||
containers can be paused.
|
|
||||||
|
|
||||||
See the [cgroups freezer documentation]
|
|
||||||
(https://www.kernel.org/doc/Documentation/cgroup-v1/freezer-subsystem.txt) for
|
|
||||||
further details.
|
|
||||||
|
|
||||||
**docker-container-unpause(1)** to unpause all processes within a container.
|
|
||||||
usage: docker container pause CONTAINER [CONTAINER...]
|
usage: docker container pause CONTAINER [CONTAINER...]
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
|
||||||
|
|
|
@ -1,32 +1,7 @@
|
||||||
command: docker container port
|
command: docker container port
|
||||||
short: List port mappings or a specific mapping for the container
|
short: List port mappings or a specific mapping for the container
|
||||||
long: |
|
long: List port mappings or a specific mapping for the container
|
||||||
List port mappings for the CONTAINER, or lookup the public-facing port that is NAT-ed to the PRIVATE_PORT
|
|
||||||
|
|
||||||
# EXAMPLES
|
|
||||||
|
|
||||||
# docker ps
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
|
||||||
b650456536c7 busybox:latest top 54 minutes ago Up 54 minutes 0.0.0.0:1234->9876/tcp, 0.0.0.0:4321->7890/tcp test
|
|
||||||
|
|
||||||
## Find out all the ports mapped
|
|
||||||
|
|
||||||
# docker container port test
|
|
||||||
7890/tcp -> 0.0.0.0:4321
|
|
||||||
9876/tcp -> 0.0.0.0:1234
|
|
||||||
|
|
||||||
## Find out a specific mapping
|
|
||||||
|
|
||||||
# docker container port test 7890/tcp
|
|
||||||
0.0.0.0:4321
|
|
||||||
|
|
||||||
# docker container port test 7890
|
|
||||||
0.0.0.0:4321
|
|
||||||
|
|
||||||
## An example showing error for non-existent mapping
|
|
||||||
|
|
||||||
# docker container port test 7890/udp
|
|
||||||
2014/06/24 11:53:36 Error: No public port '7890/udp' published for test
|
|
||||||
usage: docker container port CONTAINER [PRIVATE_PORT[/PROTO]]
|
usage: docker container port CONTAINER [PRIVATE_PORT[/PROTO]]
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
|
||||||
|
|
|
@ -11,3 +11,4 @@ options:
|
||||||
shorthand: f
|
shorthand: f
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Do not prompt for confirmation
|
description: Do not prompt for confirmation
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
command: docker container rename
|
command: docker container rename
|
||||||
short: Rename a container
|
short: Rename a container
|
||||||
long: |
|
long: Rename a container
|
||||||
Rename a container. Container may be running, paused or stopped.
|
|
||||||
usage: docker container rename CONTAINER NEW_NAME
|
usage: docker container rename CONTAINER NEW_NAME
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
command: docker container restart
|
command: docker container restart
|
||||||
short: Restart one or more containers
|
short: Restart one or more containers
|
||||||
long: |
|
long: Restart one or more containers
|
||||||
Restart each container listed.
|
|
||||||
usage: docker container restart [OPTIONS] CONTAINER [CONTAINER...]
|
usage: docker container restart [OPTIONS] CONTAINER [CONTAINER...]
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
@ -10,3 +9,4 @@ options:
|
||||||
shorthand: t
|
shorthand: t
|
||||||
default_value: "10"
|
default_value: "10"
|
||||||
description: Seconds to wait for stop before killing the container
|
description: Seconds to wait for stop before killing the container
|
||||||
|
|
||||||
|
|
|
@ -1,43 +1,6 @@
|
||||||
command: docker container rm
|
command: docker container rm
|
||||||
short: Remove one or more containers
|
short: Remove one or more containers
|
||||||
long: |
|
long: Remove one or more containers
|
||||||
**docker container rm** will remove one or more containers from the host node. The
|
|
||||||
container name or ID can be used. This does not remove images. You cannot
|
|
||||||
remove a running container unless you use the **-f** option. To see all
|
|
||||||
containers on a host use the **docker container ls -a** command.
|
|
||||||
|
|
||||||
# EXAMPLES
|
|
||||||
|
|
||||||
## Removing a container using its ID
|
|
||||||
|
|
||||||
To remove a container using its ID, find either from a **docker ps -a**
|
|
||||||
command, or use the ID returned from the **docker run** command, or retrieve
|
|
||||||
it from a file used to store it using the **docker run --cidfile**:
|
|
||||||
|
|
||||||
docker container rm abebf7571666
|
|
||||||
|
|
||||||
## Removing a container using the container name
|
|
||||||
|
|
||||||
The name of the container can be found using the **docker ps -a**
|
|
||||||
command. The use that name as follows:
|
|
||||||
|
|
||||||
docker container rm hopeful_morse
|
|
||||||
|
|
||||||
## Removing a container and all associated volumes
|
|
||||||
|
|
||||||
$ docker container rm -v redis
|
|
||||||
redis
|
|
||||||
|
|
||||||
This command will remove the container and any volumes associated with it.
|
|
||||||
Note that if a volume was specified with a name, it will not be removed.
|
|
||||||
|
|
||||||
$ docker create -v awesome:/foo -v /bar --name hello redis
|
|
||||||
hello
|
|
||||||
$ docker container rm -v hello
|
|
||||||
|
|
||||||
In this example, the volume for `/foo` will remain in tact, but the volume for
|
|
||||||
`/bar` will be removed. The same behavior holds for volumes inherited with
|
|
||||||
`--volumes-from`.
|
|
||||||
usage: docker container rm [OPTIONS] CONTAINER [CONTAINER...]
|
usage: docker container rm [OPTIONS] CONTAINER [CONTAINER...]
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
@ -54,3 +17,4 @@ options:
|
||||||
shorthand: v
|
shorthand: v
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Remove the volumes associated with the container
|
description: Remove the volumes associated with the container
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
command: docker container run
|
command: docker container run
|
||||||
short: Run a command in a new container
|
short: Run a command in a new container
|
||||||
long: |
|
long: Run a command in a new container
|
||||||
Alias for `docker run`.
|
|
||||||
usage: docker container run [OPTIONS] IMAGE [COMMAND] [ARG...]
|
usage: docker container run [OPTIONS] IMAGE [COMMAND] [ARG...]
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
@ -70,6 +69,9 @@ options:
|
||||||
- option: device
|
- option: device
|
||||||
default_value: '[]'
|
default_value: '[]'
|
||||||
description: Add a host device to the container
|
description: Add a host device to the container
|
||||||
|
- option: device-cgroup-rule
|
||||||
|
default_value: '[]'
|
||||||
|
description: Add a rule to the cgroup allowed devices list
|
||||||
- option: device-read-bps
|
- option: device-read-bps
|
||||||
default_value: '[]'
|
default_value: '[]'
|
||||||
description: Limit read rate (bytes per second) from a device
|
description: Limit read rate (bytes per second) from a device
|
||||||
|
@ -115,13 +117,13 @@ options:
|
||||||
- option: health-cmd
|
- option: health-cmd
|
||||||
description: Command to run to check health
|
description: Command to run to check health
|
||||||
- option: health-interval
|
- option: health-interval
|
||||||
default_value: "0"
|
default_value: 0s
|
||||||
description: Time between running the check (ns|us|ms|s|m|h) (default 0s)
|
description: Time between running the check (ns|us|ms|s|m|h) (default 0s)
|
||||||
- option: health-retries
|
- option: health-retries
|
||||||
default_value: "0"
|
default_value: "0"
|
||||||
description: Consecutive failures needed to report unhealthy
|
description: Consecutive failures needed to report unhealthy
|
||||||
- option: health-timeout
|
- option: health-timeout
|
||||||
default_value: "0"
|
default_value: 0s
|
||||||
description: |
|
description: |
|
||||||
Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)
|
Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)
|
||||||
- option: help
|
- option: help
|
||||||
|
@ -241,7 +243,8 @@ options:
|
||||||
default_value: '[]'
|
default_value: '[]'
|
||||||
description: Security Options
|
description: Security Options
|
||||||
- option: shm-size
|
- option: shm-size
|
||||||
description: Size of /dev/shm, default value is 64MB
|
default_value: "0"
|
||||||
|
description: Size of /dev/shm
|
||||||
- option: sig-proxy
|
- option: sig-proxy
|
||||||
default_value: "true"
|
default_value: "true"
|
||||||
description: Proxy received signals to the process
|
description: Proxy received signals to the process
|
||||||
|
@ -286,3 +289,4 @@ options:
|
||||||
- option: workdir
|
- option: workdir
|
||||||
shorthand: w
|
shorthand: w
|
||||||
description: Working directory inside the container
|
description: Working directory inside the container
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
command: docker container start
|
command: docker container start
|
||||||
short: Start one or more stopped containers
|
short: Start one or more stopped containers
|
||||||
long: |
|
long: Start one or more stopped containers
|
||||||
Start one or more containers.
|
|
||||||
usage: docker container start [OPTIONS] CONTAINER [CONTAINER...]
|
usage: docker container start [OPTIONS] CONTAINER [CONTAINER...]
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
@ -20,3 +19,4 @@ options:
|
||||||
shorthand: i
|
shorthand: i
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Attach container's STDIN
|
description: Attach container's STDIN
|
||||||
|
|
||||||
|
|
|
@ -1,38 +1,6 @@
|
||||||
command: docker container stats
|
command: docker container stats
|
||||||
short: Display a live stream of container(s) resource usage statistics
|
short: Display a live stream of container(s) resource usage statistics
|
||||||
long: |
|
long: Display a live stream of container(s) resource usage statistics
|
||||||
Display a live stream of one or more containers' resource usage statistics
|
|
||||||
|
|
||||||
# Format
|
|
||||||
|
|
||||||
Pretty-print containers statistics using a Go template.
|
|
||||||
Valid placeholders:
|
|
||||||
.Container - Container name or ID.
|
|
||||||
.Name - Container name.
|
|
||||||
.ID - Container ID.
|
|
||||||
.CPUPerc - CPU percentage.
|
|
||||||
.MemUsage - Memory usage.
|
|
||||||
.NetIO - Network IO.
|
|
||||||
.BlockIO - Block IO.
|
|
||||||
.MemPerc - Memory percentage (Not available on Windows).
|
|
||||||
.PIDs - Number of PIDs (Not available on Windows).
|
|
||||||
|
|
||||||
# EXAMPLES
|
|
||||||
|
|
||||||
Running `docker container stats` on all running containers
|
|
||||||
|
|
||||||
$ docker container stats
|
|
||||||
CONTAINER CPU %!M(MISSING)EM USAGE / LIMIT MEM %!N(MISSING)ET I/O BLOCK I/O
|
|
||||||
1285939c1fd3 0.07%! (MISSING)KiB / 64 MiB 1.21%! (MISSING)B / 648 B 3.568 MB / 512 KB
|
|
||||||
9c76f7834ae2 0.07%! (MISSING)MiB / 64 MiB 4.29%! (MISSING)KB / 648 B 12.4 MB / 0 B
|
|
||||||
d1ea048f04e4 0.03%! (MISSING)MiB / 64 MiB 6.30%! (MISSING)KB / 648 B 27.7 MB / 0 B
|
|
||||||
|
|
||||||
Running `docker container stats` on multiple containers by name and id.
|
|
||||||
|
|
||||||
$ docker container stats fervent_panini 5acfcb1b4fd1
|
|
||||||
CONTAINER CPU %!M(MISSING)EM USAGE/LIMIT MEM %!N(MISSING)ET I/O
|
|
||||||
5acfcb1b4fd1 0.00%! (MISSING)MiB/1.045 GiB 11.03%! (MISSING)kB/648 B
|
|
||||||
fervent_panini 0.02%! (MISSING)MiB/1.045 GiB 1.06%! (MISSING)B/648 B
|
|
||||||
usage: docker container stats [OPTIONS] [CONTAINER...]
|
usage: docker container stats [OPTIONS] [CONTAINER...]
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
@ -46,3 +14,4 @@ options:
|
||||||
- option: no-stream
|
- option: no-stream
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Disable streaming stats and only pull the first result
|
description: Disable streaming stats and only pull the first result
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
command: docker container stop
|
command: docker container stop
|
||||||
short: Stop one or more running containers
|
short: Stop one or more running containers
|
||||||
long: |
|
long: Stop one or more running containers
|
||||||
Stop a container (Send SIGTERM, and then SIGKILL after grace period)
|
|
||||||
usage: docker container stop [OPTIONS] CONTAINER [CONTAINER...]
|
usage: docker container stop [OPTIONS] CONTAINER [CONTAINER...]
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
@ -10,3 +9,4 @@ options:
|
||||||
shorthand: t
|
shorthand: t
|
||||||
default_value: "10"
|
default_value: "10"
|
||||||
description: Seconds to wait for stop before killing it
|
description: Seconds to wait for stop before killing it
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,7 @@
|
||||||
command: docker container top
|
command: docker container top
|
||||||
short: Display the running processes of a container
|
short: Display the running processes of a container
|
||||||
long: |
|
long: Display the running processes of a container
|
||||||
Display the running process of the container. ps-OPTION can be any of the options you would pass to a Linux ps command.
|
|
||||||
|
|
||||||
All displayed information is from host's point of view.
|
|
||||||
|
|
||||||
# EXAMPLES
|
|
||||||
|
|
||||||
Run **docker container top** with the ps option of -x:
|
|
||||||
|
|
||||||
$ docker container top 8601afda2b -x
|
|
||||||
PID TTY STAT TIME COMMAND
|
|
||||||
16623 ? Ss 0:00 sleep 99999
|
|
||||||
usage: docker container top CONTAINER [ps OPTIONS]
|
usage: docker container top CONTAINER [ps OPTIONS]
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
command: docker container unpause
|
command: docker container unpause
|
||||||
short: Unpause all processes within one or more containers
|
short: Unpause all processes within one or more containers
|
||||||
long: |
|
long: Unpause all processes within one or more containers
|
||||||
The `docker container unpause` command un-suspends all processes in a container.
|
|
||||||
On Linux, it does this using the cgroups freezer.
|
|
||||||
|
|
||||||
See the [cgroups freezer documentation]
|
|
||||||
(https://www.kernel.org/doc/Documentation/cgroup-v1/freezer-subsystem.txt) for
|
|
||||||
further details.
|
|
||||||
usage: docker container unpause CONTAINER [CONTAINER...]
|
usage: docker container unpause CONTAINER [CONTAINER...]
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
|
||||||
|
|
|
@ -1,50 +1,6 @@
|
||||||
command: docker container update
|
command: docker container update
|
||||||
short: Update configuration of one or more containers
|
short: Update configuration of one or more containers
|
||||||
long: "The **docker container update** command dynamically updates container configuration.\nYou
|
long: Update configuration of one or more containers
|
||||||
can use this command to prevent containers from consuming too many \nresources from
|
|
||||||
their Docker host. With a single command, you can place \nlimits on a single container
|
|
||||||
or on many. To specify more than one container,\nprovide space-separated list of
|
|
||||||
container names or IDs.\n\nWith the exception of the **--kernel-memory** option,
|
|
||||||
you can specify these\noptions on a running or a stopped container. On kernel version
|
|
||||||
older than\n4.6, You can only update **--kernel-memory** on a stopped container
|
|
||||||
or on\na running container with kernel memory initialized.\n\n# OPTIONS\n\n## kernel-memory\n\nKernel
|
|
||||||
memory limit (format: `<number>[<unit>]`, where unit = b, k, m or g)\n\nNote that
|
|
||||||
on kernel version older than 4.6, you can not update kernel memory on\na running
|
|
||||||
container if the container is started without kernel memory initialized,\nin this
|
|
||||||
case, it can only be updated after it's stopped. The new setting takes\neffect when
|
|
||||||
the container is started.\n\n## memory\n\nMemory limit (format: <number><optional
|
|
||||||
unit>, where unit = b, k, m or g)\n\nNote that the memory should be smaller than
|
|
||||||
the already set swap memory limit.\nIf you want update a memory limit bigger than
|
|
||||||
the already set swap memory limit,\nyou should update swap memory limit at the same
|
|
||||||
time. If you don't set swap memory \nlimit on docker create/run but only memory
|
|
||||||
limit, the swap memory is double\nthe memory limit.\n\n# EXAMPLES\n\nThe following
|
|
||||||
sections illustrate ways to use this command.\n\n### Update a container's cpu-shares\n\nTo
|
|
||||||
limit a container's cpu-shares to 512, first identify the container\nname or ID.
|
|
||||||
You can use **docker ps** to find these values. You can also\nuse the ID returned
|
|
||||||
from the **docker run** command. Then, do the following:\n\n```bash\n$ docker container
|
|
||||||
update --cpu-shares 512 abebf7571666\n```\n\n### Update a container with cpu-shares
|
|
||||||
and memory\n\nTo update multiple resource configurations for multiple containers:\n\n```bash\n$
|
|
||||||
docker container update --cpu-shares 512 -m 300M abebf7571666 hopeful_morse\n```\n\n###
|
|
||||||
Update a container's kernel memory constraints\n\nYou can update a container's kernel
|
|
||||||
memory limit using the **--kernel-memory**\noption. On kernel version older than
|
|
||||||
4.6, this option can be updated on a\nrunning container only if the container was
|
|
||||||
started with **--kernel-memory**.\nIf the container was started *without* **--kernel-memory**
|
|
||||||
you need to stop\nthe container before updating kernel memory.\n\nFor example, if
|
|
||||||
you started a container with this command:\n\n```bash\n$ docker run -dit --name
|
|
||||||
test --kernel-memory 50M ubuntu bash\n```\n\nYou can update kernel memory while
|
|
||||||
the container is running:\n\n```bash\n$ docker container update --kernel-memory
|
|
||||||
80M test\n```\n\nIf you started a container *without* kernel memory initialized:\n\n```bash\n$
|
|
||||||
docker run -dit --name test2 --memory 300M ubuntu bash\n```\n\nUpdate kernel memory
|
|
||||||
of running container `test2` will fail. You need to stop\nthe container before updating
|
|
||||||
the **--kernel-memory** setting. The next time you\nstart it, the container uses
|
|
||||||
the new value.\n\nKernel version newer than (include) 4.6 does not have this limitation,
|
|
||||||
you\ncan use `--kernel-memory` the same way as other options.\n\n### Update a container's
|
|
||||||
restart policy\n\nYou can change a container's restart policy on a running container.
|
|
||||||
The new\nrestart policy takes effect instantly after you run `docker container update`
|
|
||||||
on a\ncontainer.\n\nTo update restart policy for one or more containers:\n\n```bash\n$
|
|
||||||
docker container update --restart=on-failure:3 abebf7571666 hopeful_morse\n```\n\nNote
|
|
||||||
that if the container is started with \"--rm\" flag, you cannot update the restart\npolicy
|
|
||||||
for it. The `AutoRemove` and `RestartPolicy` are mutually exclusive for the\ncontainer.\n"
|
|
||||||
usage: docker container update [OPTIONS] CONTAINER [CONTAINER...]
|
usage: docker container update [OPTIONS] CONTAINER [CONTAINER...]
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
@ -85,3 +41,4 @@ options:
|
||||||
Swap limit equal to memory plus swap: '-1' to enable unlimited swap
|
Swap limit equal to memory plus swap: '-1' to enable unlimited swap
|
||||||
- option: restart
|
- option: restart
|
||||||
description: Restart policy to apply when a container exits
|
description: Restart policy to apply when a container exits
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
command: docker container wait
|
command: docker container wait
|
||||||
short: Block until one or more containers stop, then print their exit codes
|
short: Block until one or more containers stop, then print their exit codes
|
||||||
long: |
|
long: Block until one or more containers stop, then print their exit codes
|
||||||
Block until a container stops, then print its exit code.
|
|
||||||
|
|
||||||
# EXAMPLES
|
|
||||||
|
|
||||||
$ docker run -d fedora sleep 99
|
|
||||||
079b83f558a2bc52ecad6b2a5de13622d584e6bb1aea058c11b36511e85e7622
|
|
||||||
$ docker container wait 079b83f558a2bc
|
|
||||||
0
|
|
||||||
usage: docker container wait CONTAINER [CONTAINER...]
|
usage: docker container wait CONTAINER [CONTAINER...]
|
||||||
pname: docker container
|
pname: docker container
|
||||||
plink: docker_container.yaml
|
plink: docker_container.yaml
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,86 @@
|
||||||
command: docker cp
|
command: docker cp
|
||||||
short: Copy files/folders between a container and the local filesystem
|
short: Copy files/folders between a container and the local filesystem
|
||||||
long: |
|
long: |-
|
||||||
Alias for `docker container cp`.
|
The `docker cp` utility copies the contents of `SRC_PATH` to the `DEST_PATH`.
|
||||||
|
You can copy from the container's file system to the local machine or the
|
||||||
|
reverse, from the local filesystem to the container. If `-` is specified for
|
||||||
|
either the `SRC_PATH` or `DEST_PATH`, you can also stream a tar archive from
|
||||||
|
`STDIN` or to `STDOUT`. The `CONTAINER` can be a running or stopped container.
|
||||||
|
The `SRC_PATH` or `DEST_PATH` can be a file or directory.
|
||||||
|
|
||||||
|
The `docker cp` command assumes container paths are relative to the container's
|
||||||
|
`/` (root) directory. This means supplying the initial forward slash is optional;
|
||||||
|
The command sees `compassionate_darwin:/tmp/foo/myfile.txt` and
|
||||||
|
`compassionate_darwin:tmp/foo/myfile.txt` as identical. Local machine paths can
|
||||||
|
be an absolute or relative value. The command interprets a local machine's
|
||||||
|
relative paths as relative to the current working directory where `docker cp` is
|
||||||
|
run.
|
||||||
|
|
||||||
|
The `cp` command behaves like the Unix `cp -a` command in that directories are
|
||||||
|
copied recursively with permissions preserved if possible. Ownership is set to
|
||||||
|
the user and primary group at the destination. For example, files copied to a
|
||||||
|
container are created with `UID:GID` of the root user. Files copied to the local
|
||||||
|
machine are created with the `UID:GID` of the user which invoked the `docker cp`
|
||||||
|
command. If you specify the `-L` option, `docker cp` follows any symbolic link
|
||||||
|
in the `SRC_PATH`. `docker cp` does *not* create parent directories for
|
||||||
|
`DEST_PATH` if they do not exist.
|
||||||
|
|
||||||
|
Assuming a path separator of `/`, a first argument of `SRC_PATH` and second
|
||||||
|
argument of `DEST_PATH`, the behavior is as follows:
|
||||||
|
|
||||||
|
- `SRC_PATH` specifies a file
|
||||||
|
- `DEST_PATH` does not exist
|
||||||
|
- the file is saved to a file created at `DEST_PATH`
|
||||||
|
- `DEST_PATH` does not exist and ends with `/`
|
||||||
|
- Error condition: the destination directory must exist.
|
||||||
|
- `DEST_PATH` exists and is a file
|
||||||
|
- the destination is overwritten with the source file's contents
|
||||||
|
- `DEST_PATH` exists and is a directory
|
||||||
|
- the file is copied into this directory using the basename from
|
||||||
|
`SRC_PATH`
|
||||||
|
- `SRC_PATH` specifies a directory
|
||||||
|
- `DEST_PATH` does not exist
|
||||||
|
- `DEST_PATH` is created as a directory and the *contents* of the source
|
||||||
|
directory are copied into this directory
|
||||||
|
- `DEST_PATH` exists and is a file
|
||||||
|
- Error condition: cannot copy a directory to a file
|
||||||
|
- `DEST_PATH` exists and is a directory
|
||||||
|
- `SRC_PATH` does not end with `/.` (that is: _slash_ followed by _dot_)
|
||||||
|
- the source directory is copied into this directory
|
||||||
|
- `SRC_PATH` does end with `/.` (that is: _slash_ followed by _dot_)
|
||||||
|
- the *content* of the source directory is copied into this
|
||||||
|
directory
|
||||||
|
|
||||||
|
The command requires `SRC_PATH` and `DEST_PATH` to exist according to the above
|
||||||
|
rules. If `SRC_PATH` is local and is a symbolic link, the symbolic link, not
|
||||||
|
the target, is copied by default. To copy the link target and not the link, specify
|
||||||
|
the `-L` option.
|
||||||
|
|
||||||
|
A colon (`:`) is used as a delimiter between `CONTAINER` and its path. You can
|
||||||
|
also use `:` when specifying paths to a `SRC_PATH` or `DEST_PATH` on a local
|
||||||
|
machine, for example `file:name.txt`. If you use a `:` in a local machine path,
|
||||||
|
you must be explicit with a relative or absolute path, for example:
|
||||||
|
|
||||||
|
`/path/to/file:name.txt` or `./file:name.txt`
|
||||||
|
|
||||||
|
It is not possible to copy certain system files such as resources under
|
||||||
|
`/proc`, `/sys`, `/dev`, [tmpfs](run.md#mount-tmpfs-tmpfs), and mounts created by
|
||||||
|
the user in the container. However, you can still copy such files by manually
|
||||||
|
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):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker exec foo tar Ccf $(dirname SRC_PATH) - $(basename SRC_PATH) | tar Cxf DEST_PATH -
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ tar Ccf $(dirname SRC_PATH) - $(basename SRC_PATH) | docker exec -i foo tar Cxf DEST_PATH -
|
||||||
|
```
|
||||||
|
|
||||||
|
Using `-` as the `SRC_PATH` streams the contents of `STDIN` as a tar archive.
|
||||||
|
The command extracts the content of the tar to the `DEST_PATH` in container's
|
||||||
|
filesystem. In this case, `DEST_PATH` must specify a directory. Using `-` as
|
||||||
|
the `DEST_PATH` streams the contents of the resource as a tar archive to `STDOUT`.
|
||||||
usage: "docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-\n\tdocker cp [OPTIONS]
|
usage: "docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-\n\tdocker cp [OPTIONS]
|
||||||
SRC_PATH|- CONTAINER:DEST_PATH"
|
SRC_PATH|- CONTAINER:DEST_PATH"
|
||||||
pname: docker
|
pname: docker
|
||||||
|
@ -11,3 +90,4 @@ options:
|
||||||
shorthand: L
|
shorthand: L
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Always follow symbol link in SRC_PATH
|
description: Always follow symbol link in SRC_PATH
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,17 @@
|
||||||
command: docker create
|
command: docker create
|
||||||
short: Create a new container
|
short: Create a new container
|
||||||
long: |
|
long: |-
|
||||||
Alias for `docker container create`.
|
The `docker create` command creates a writeable container layer over the
|
||||||
|
specified image and prepares it for running the specified command. The
|
||||||
|
container ID is then printed to `STDOUT`. This is similar to `docker run -d`
|
||||||
|
except the container is never started. You can then use the
|
||||||
|
`docker start <container_id>` command to start the container at any point.
|
||||||
|
|
||||||
|
This is useful when you want to set up a container configuration ahead of time
|
||||||
|
so that it is ready to start when you need it. The initial status of the
|
||||||
|
new container is `created`.
|
||||||
|
|
||||||
|
Please see the [run command](run.md) section and the [Docker run reference](../run.md) for more details.
|
||||||
usage: docker create [OPTIONS] IMAGE [COMMAND] [ARG...]
|
usage: docker create [OPTIONS] IMAGE [COMMAND] [ARG...]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -64,6 +74,9 @@ options:
|
||||||
- option: device
|
- option: device
|
||||||
default_value: '[]'
|
default_value: '[]'
|
||||||
description: Add a host device to the container
|
description: Add a host device to the container
|
||||||
|
- option: device-cgroup-rule
|
||||||
|
default_value: '[]'
|
||||||
|
description: Add a rule to the cgroup allowed devices list
|
||||||
- option: device-read-bps
|
- option: device-read-bps
|
||||||
default_value: '[]'
|
default_value: '[]'
|
||||||
description: Limit read rate (bytes per second) from a device
|
description: Limit read rate (bytes per second) from a device
|
||||||
|
@ -109,13 +122,13 @@ options:
|
||||||
- option: health-cmd
|
- option: health-cmd
|
||||||
description: Command to run to check health
|
description: Command to run to check health
|
||||||
- option: health-interval
|
- option: health-interval
|
||||||
default_value: "0"
|
default_value: 0s
|
||||||
description: Time between running the check (ns|us|ms|s|m|h) (default 0s)
|
description: Time between running the check (ns|us|ms|s|m|h) (default 0s)
|
||||||
- option: health-retries
|
- option: health-retries
|
||||||
default_value: "0"
|
default_value: "0"
|
||||||
description: Consecutive failures needed to report unhealthy
|
description: Consecutive failures needed to report unhealthy
|
||||||
- option: health-timeout
|
- option: health-timeout
|
||||||
default_value: "0"
|
default_value: 0s
|
||||||
description: |
|
description: |
|
||||||
Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)
|
Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)
|
||||||
- option: help
|
- option: help
|
||||||
|
@ -235,7 +248,8 @@ options:
|
||||||
default_value: '[]'
|
default_value: '[]'
|
||||||
description: Security Options
|
description: Security Options
|
||||||
- option: shm-size
|
- option: shm-size
|
||||||
description: Size of /dev/shm, default value is 64MB
|
default_value: "0"
|
||||||
|
description: Size of /dev/shm
|
||||||
- option: stop-signal
|
- option: stop-signal
|
||||||
default_value: SIGTERM
|
default_value: SIGTERM
|
||||||
description: Signal to stop a container, SIGTERM by default
|
description: Signal to stop a container, SIGTERM by default
|
||||||
|
@ -277,3 +291,89 @@ options:
|
||||||
- option: workdir
|
- option: workdir
|
||||||
shorthand: w
|
shorthand: w
|
||||||
description: Working directory inside the container
|
description: Working directory inside the container
|
||||||
|
example: |-
|
||||||
|
### Create and start a container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker create -t -i fedora bash
|
||||||
|
|
||||||
|
6d8af538ec541dd581ebc2a24153a28329acb5268abe5ef868c1f1a261221752
|
||||||
|
|
||||||
|
$ docker start -a -i 6d8af538ec5
|
||||||
|
|
||||||
|
bash-4.2#
|
||||||
|
```
|
||||||
|
|
||||||
|
### Initialize volumes
|
||||||
|
|
||||||
|
As of v1.4.0 container volumes are initialized during the `docker create` phase
|
||||||
|
(i.e., `docker run` too). For example, this allows you to `create` the `data`
|
||||||
|
volume container, and then use it from another container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker create -v /data --name data ubuntu
|
||||||
|
|
||||||
|
240633dfbb98128fa77473d3d9018f6123b99c454b3251427ae190a7d951ad57
|
||||||
|
|
||||||
|
$ docker run --rm --volumes-from data ubuntu ls -la /data
|
||||||
|
|
||||||
|
total 8
|
||||||
|
drwxr-xr-x 2 root root 4096 Dec 5 04:10 .
|
||||||
|
drwxr-xr-x 48 root root 4096 Dec 5 04:11 ..
|
||||||
|
```
|
||||||
|
|
||||||
|
Similarly, `create` a host directory bind mounted volume container, which can
|
||||||
|
then be used from the subsequent container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker create -v /home/docker:/docker --name docker ubuntu
|
||||||
|
|
||||||
|
9aa88c08f319cd1e4515c3c46b0de7cc9aa75e878357b1e96f91e2c773029f03
|
||||||
|
|
||||||
|
$ docker run --rm --volumes-from docker ubuntu ls -la /docker
|
||||||
|
|
||||||
|
total 20
|
||||||
|
drwxr-sr-x 5 1000 staff 180 Dec 5 04:00 .
|
||||||
|
drwxr-xr-x 48 root root 4096 Dec 5 04:13 ..
|
||||||
|
-rw-rw-r-- 1 1000 staff 3833 Dec 5 04:01 .ash_history
|
||||||
|
-rw-r--r-- 1 1000 staff 446 Nov 28 11:51 .ashrc
|
||||||
|
-rw-r--r-- 1 1000 staff 25 Dec 5 04:00 .gitconfig
|
||||||
|
drwxr-sr-x 3 1000 staff 60 Dec 1 03:28 .local
|
||||||
|
-rw-r--r-- 1 1000 staff 920 Nov 28 11:51 .profile
|
||||||
|
drwx--S--- 2 1000 staff 460 Dec 5 00:51 .ssh
|
||||||
|
drwxr-xr-x 32 1000 staff 1140 Dec 5 04:01 docker
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Set storage driver options per container.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker create -it --storage-opt size=120G fedora /bin/bash
|
||||||
|
```
|
||||||
|
|
||||||
|
This (size) will allow to set the container rootfs size to 120G at creation time.
|
||||||
|
This option is only available for the `devicemapper`, `btrfs`, `overlay2`,
|
||||||
|
`windowsfilter` and `zfs` graph drivers.
|
||||||
|
For the `devicemapper`, `btrfs`, `windowsfilter` and `zfs` graph drivers,
|
||||||
|
user cannot pass a size less than the Default BaseFS Size.
|
||||||
|
For the `overlay2` storage driver, the size option is only available if the
|
||||||
|
backing fs is `xfs` and mounted with the `pquota` mount option.
|
||||||
|
Under these conditions, user can pass any size less then the backing fs size.
|
||||||
|
|
||||||
|
### Specify isolation technology for container (--isolation)
|
||||||
|
|
||||||
|
This option is useful in situations where you are running Docker containers on
|
||||||
|
Windows. The `--isolation=<value>` option sets a container's isolation
|
||||||
|
technology. On Linux, the only supported is the `default` option which uses
|
||||||
|
Linux namespaces. On Microsoft Windows, you can specify these values:
|
||||||
|
|
||||||
|
|
||||||
|
| Value | Description |
|
||||||
|
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| `default` | Use the value specified by the Docker daemon's `--exec-opt` . If the `daemon` does not specify an isolation technology, Microsoft Windows uses `process` as its default value if the
|
||||||
|
daemon is running on Windows server, or `hyperv` if running on Windows client. |
|
||||||
|
| `process` | Namespace isolation only. |
|
||||||
|
| `hyperv` | Hyper-V hypervisor partition-based isolation. |
|
||||||
|
|
||||||
|
Specifying the `--isolation` flag without a value is the same as setting `--isolation="default"`.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
command: docker deploy
|
command: docker deploy
|
||||||
short: Deploy a new stack or update an existing stack
|
short: Deploy a new stack or update an existing stack
|
||||||
long: Deploy a new stack or update an existing stack
|
long: |-
|
||||||
|
Create and update a stack from a `compose` or a `dab` file on the swarm. This command
|
||||||
|
has to be run targeting a manager node.
|
||||||
usage: docker deploy [OPTIONS] STACK
|
usage: docker deploy [OPTIONS] STACK
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -13,3 +15,65 @@ options:
|
||||||
- option: with-registry-auth
|
- option: with-registry-auth
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Send registry authentication details to Swarm agents
|
description: Send registry authentication details to Swarm agents
|
||||||
|
example: |-
|
||||||
|
### Compose file
|
||||||
|
|
||||||
|
The `deploy` command supports compose file version `3.0` and above.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker stack deploy --compose-file docker-compose.yml vossibility
|
||||||
|
|
||||||
|
Ignoring unsupported options: links
|
||||||
|
|
||||||
|
Creating network vossibility_vossibility
|
||||||
|
Creating network vossibility_default
|
||||||
|
Creating service vossibility_nsqd
|
||||||
|
Creating service vossibility_logstash
|
||||||
|
Creating service vossibility_elasticsearch
|
||||||
|
Creating service vossibility_kibana
|
||||||
|
Creating service vossibility_ghollector
|
||||||
|
Creating service vossibility_lookupd
|
||||||
|
```
|
||||||
|
|
||||||
|
You can verify that the services were correctly created
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker service ls
|
||||||
|
|
||||||
|
ID NAME MODE REPLICAS IMAGE
|
||||||
|
29bv0vnlm903 vossibility_lookupd replicated 1/1 nsqio/nsq@sha256:eeba05599f31eba418e96e71e0984c3dc96963ceb66924dd37a47bf7ce18a662
|
||||||
|
4awt47624qwh vossibility_nsqd replicated 1/1 nsqio/nsq@sha256:eeba05599f31eba418e96e71e0984c3dc96963ceb66924dd37a47bf7ce18a662
|
||||||
|
4tjx9biia6fs vossibility_elasticsearch replicated 1/1 elasticsearch@sha256:12ac7c6af55d001f71800b83ba91a04f716e58d82e748fa6e5a7359eed2301aa
|
||||||
|
7563uuzr9eys vossibility_kibana replicated 1/1 kibana@sha256:6995a2d25709a62694a937b8a529ff36da92ebee74bafd7bf00e6caf6db2eb03
|
||||||
|
9gc5m4met4he vossibility_logstash replicated 1/1 logstash@sha256:2dc8bddd1bb4a5a34e8ebaf73749f6413c101b2edef6617f2f7713926d2141fe
|
||||||
|
axqh55ipl40h vossibility_vossibility-collector replicated 1/1 icecrime/vossibility-collector@sha256:f03f2977203ba6253988c18d04061c5ec7aab46bca9dfd89a9a1fa4500989fba
|
||||||
|
```
|
||||||
|
|
||||||
|
### DAB file
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker stack deploy --bundle-file vossibility-stack.dab vossibility
|
||||||
|
|
||||||
|
Loading bundle from vossibility-stack.dab
|
||||||
|
Creating service vossibility_elasticsearch
|
||||||
|
Creating service vossibility_kibana
|
||||||
|
Creating service vossibility_logstash
|
||||||
|
Creating service vossibility_lookupd
|
||||||
|
Creating service vossibility_nsqd
|
||||||
|
Creating service vossibility_vossibility-collector
|
||||||
|
```
|
||||||
|
|
||||||
|
You can verify that the services were correctly created:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker service ls
|
||||||
|
|
||||||
|
ID NAME MODE REPLICAS IMAGE
|
||||||
|
29bv0vnlm903 vossibility_lookupd replicated 1/1 nsqio/nsq@sha256:eeba05599f31eba418e96e71e0984c3dc96963ceb66924dd37a47bf7ce18a662
|
||||||
|
4awt47624qwh vossibility_nsqd replicated 1/1 nsqio/nsq@sha256:eeba05599f31eba418e96e71e0984c3dc96963ceb66924dd37a47bf7ce18a662
|
||||||
|
4tjx9biia6fs vossibility_elasticsearch replicated 1/1 elasticsearch@sha256:12ac7c6af55d001f71800b83ba91a04f716e58d82e748fa6e5a7359eed2301aa
|
||||||
|
7563uuzr9eys vossibility_kibana replicated 1/1 kibana@sha256:6995a2d25709a62694a937b8a529ff36da92ebee74bafd7bf00e6caf6db2eb03
|
||||||
|
9gc5m4met4he vossibility_logstash replicated 1/1 logstash@sha256:2dc8bddd1bb4a5a34e8ebaf73749f6413c101b2edef6617f2f7713926d2141fe
|
||||||
|
axqh55ipl40h vossibility_vossibility-collector replicated 1/1 icecrime/vossibility-collector@sha256:f03f2977203ba6253988c18d04061c5ec7aab46bca9dfd89a9a1fa4500989fba
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,44 @@
|
||||||
command: docker diff
|
command: docker diff
|
||||||
short: Inspect changes to files or directories on a container's filesystem
|
short: Inspect changes to files or directories on a container's filesystem
|
||||||
long: |
|
long: |-
|
||||||
Alias for `docker container diff`.
|
List the changed files and directories in a container᾿s filesystem since the
|
||||||
|
container was created. Three different types of change are tracked:
|
||||||
|
|
||||||
|
| Symbol | Description |
|
||||||
|
|--------|---------------------------------|
|
||||||
|
| `A` | A file or directory was added |
|
||||||
|
| `D` | A file or directory was deleted |
|
||||||
|
| `C` | A file or directory was changed |
|
||||||
|
|
||||||
|
You can use the full or shortened container ID or the container name set using
|
||||||
|
`docker run --name` option.
|
||||||
usage: docker diff CONTAINER
|
usage: docker diff CONTAINER
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
example: |-
|
||||||
|
Inspect the changes to an `nginx` container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker diff 1fdfd1f54c1b
|
||||||
|
|
||||||
|
C /dev
|
||||||
|
C /dev/console
|
||||||
|
C /dev/core
|
||||||
|
C /dev/stdout
|
||||||
|
C /dev/fd
|
||||||
|
C /dev/ptmx
|
||||||
|
C /dev/stderr
|
||||||
|
C /dev/stdin
|
||||||
|
C /run
|
||||||
|
A /run/nginx.pid
|
||||||
|
C /var/lib/nginx/tmp
|
||||||
|
A /var/lib/nginx/tmp/client_body
|
||||||
|
A /var/lib/nginx/tmp/fastcgi
|
||||||
|
A /var/lib/nginx/tmp/proxy
|
||||||
|
A /var/lib/nginx/tmp/scgi
|
||||||
|
A /var/lib/nginx/tmp/uwsgi
|
||||||
|
C /var/log/nginx
|
||||||
|
A /var/log/nginx/access.log
|
||||||
|
A /var/log/nginx/error.log
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,137 @@
|
||||||
command: docker events
|
command: docker events
|
||||||
short: Get real time events from the server
|
short: Get real time events from the server
|
||||||
long: |
|
long: |-
|
||||||
Alias for `docker system events`.
|
Use `docker events` to get real-time events from the server. These events differ
|
||||||
|
per Docker object type.
|
||||||
|
|
||||||
|
### Object types
|
||||||
|
|
||||||
|
#### Containers
|
||||||
|
|
||||||
|
Docker containers report the following events:
|
||||||
|
|
||||||
|
- `attach`
|
||||||
|
- `commit`
|
||||||
|
- `copy`
|
||||||
|
- `create`
|
||||||
|
- `destroy`
|
||||||
|
- `detach`
|
||||||
|
- `die`
|
||||||
|
- `exec_create`
|
||||||
|
- `exec_detach`
|
||||||
|
- `exec_start`
|
||||||
|
- `export`
|
||||||
|
- `health_status`
|
||||||
|
- `kill`
|
||||||
|
- `oom`
|
||||||
|
- `pause`
|
||||||
|
- `rename`
|
||||||
|
- `resize`
|
||||||
|
- `restart`
|
||||||
|
- `start`
|
||||||
|
- `stop`
|
||||||
|
- `top`
|
||||||
|
- `unpause`
|
||||||
|
- `update`
|
||||||
|
|
||||||
|
#### Images
|
||||||
|
|
||||||
|
Docker images report the following events:
|
||||||
|
|
||||||
|
- `delete`
|
||||||
|
- `import`
|
||||||
|
- `load`
|
||||||
|
- `pull`
|
||||||
|
- `push`
|
||||||
|
- `save`
|
||||||
|
- `tag`
|
||||||
|
- `untag`
|
||||||
|
|
||||||
|
#### Plugins
|
||||||
|
|
||||||
|
Docker plugins report the following events:
|
||||||
|
|
||||||
|
- `install`
|
||||||
|
- `enable`
|
||||||
|
- `disable`
|
||||||
|
- `remove`
|
||||||
|
|
||||||
|
#### Volumes
|
||||||
|
|
||||||
|
Docker volumes report the following events:
|
||||||
|
|
||||||
|
- `create`
|
||||||
|
- `mount`
|
||||||
|
- `unmount`
|
||||||
|
- `destroy`
|
||||||
|
|
||||||
|
#### Networks
|
||||||
|
|
||||||
|
Docker networks report the following events:
|
||||||
|
|
||||||
|
- `create`
|
||||||
|
- `connect`
|
||||||
|
- `disconnect`
|
||||||
|
- `destroy`
|
||||||
|
|
||||||
|
#### Daemons
|
||||||
|
|
||||||
|
Docker daemons report the following events:
|
||||||
|
|
||||||
|
- `reload`
|
||||||
|
|
||||||
|
### Limiting, filtering, and formatting the output
|
||||||
|
|
||||||
|
#### Limit events by time
|
||||||
|
|
||||||
|
The `--since` and `--until` parameters can be Unix timestamps, date formatted
|
||||||
|
timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed
|
||||||
|
relative to the client machine’s time. If you do not provide the `--since` option,
|
||||||
|
the command returns only new and/or live events. Supported formats for date
|
||||||
|
formatted time stamps include RFC3339Nano, RFC3339, `2006-01-02T15:04:05`,
|
||||||
|
`2006-01-02T15:04:05.999999999`, `2006-01-02Z07:00`, and `2006-01-02`. The local
|
||||||
|
timezone on the client will be used if you do not provide either a `Z` or a
|
||||||
|
`+-00:00` timezone offset at the end of the timestamp. When providing Unix
|
||||||
|
timestamps enter seconds[.nanoseconds], where seconds is the number of seconds
|
||||||
|
that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap
|
||||||
|
seconds (aka Unix epoch or Unix time), and the optional .nanoseconds field is a
|
||||||
|
fraction of a second no more than nine digits long.
|
||||||
|
|
||||||
|
#### Filtering
|
||||||
|
|
||||||
|
The filtering flag (`-f` or `--filter`) format is of "key=value". If you would
|
||||||
|
like to use multiple filters, pass multiple flags (e.g.,
|
||||||
|
`--filter "foo=bar" --filter "bif=baz"`)
|
||||||
|
|
||||||
|
Using the same filter multiple times will be handled as a *OR*; for example
|
||||||
|
`--filter container=588a23dac085 --filter container=a8f7720b8c22` will display
|
||||||
|
events for container 588a23dac085 *OR* container a8f7720b8c22
|
||||||
|
|
||||||
|
Using multiple filters will be handled as a *AND*; for example
|
||||||
|
`--filter container=588a23dac085 --filter event=start` will display events for
|
||||||
|
container container 588a23dac085 *AND* the event type is *start*
|
||||||
|
|
||||||
|
The currently supported filters are:
|
||||||
|
|
||||||
|
* container (`container=<name or id>`)
|
||||||
|
* daemon (`daemon=<name or id>`)
|
||||||
|
* event (`event=<event action>`)
|
||||||
|
* image (`image=<tag or id>`)
|
||||||
|
* label (`label=<key>` or `label=<key>=<value>`)
|
||||||
|
* network (`network=<name or id>`)
|
||||||
|
* plugin (`plugin=<name or id>`)
|
||||||
|
* type (`type=<container or image or volume or network or daemon>`)
|
||||||
|
* volume (`volume=<name or id>`)
|
||||||
|
|
||||||
|
#### Format
|
||||||
|
|
||||||
|
If a format (`--format`) is specified, the given template will be executed
|
||||||
|
instead of the default
|
||||||
|
format. Go's [text/template](http://golang.org/pkg/text/template/) package
|
||||||
|
describes all the details of the format.
|
||||||
|
|
||||||
|
If a format is set to `{{json .}}`, the events are streamed as valid JSON
|
||||||
|
Lines. For information about JSON Lines, please refer to http://jsonlines.org/ .
|
||||||
usage: docker events [OPTIONS]
|
usage: docker events [OPTIONS]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -15,3 +145,192 @@ options:
|
||||||
description: Show all events created since timestamp
|
description: Show all events created since timestamp
|
||||||
- option: until
|
- option: until
|
||||||
description: Stream events until this timestamp
|
description: Stream events until this timestamp
|
||||||
|
example: |-
|
||||||
|
### Basic example
|
||||||
|
|
||||||
|
You'll need two shells for this example.
|
||||||
|
|
||||||
|
**Shell 1: Listening for events:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker events
|
||||||
|
```
|
||||||
|
|
||||||
|
**Shell 2: Start and Stop containers:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker create --name test alpine:latest top
|
||||||
|
$ docker start test
|
||||||
|
$ docker stop test
|
||||||
|
```
|
||||||
|
|
||||||
|
**Shell 1: (Again .. now showing events):**
|
||||||
|
|
||||||
|
```none
|
||||||
|
2017-01-05T00:35:58.859401177+08:00 container create 0fdb48addc82871eb34eb23a847cfd033dedd1a0a37bef2e6d9eb3870fc7ff37 (image=alpine:latest, name=test)
|
||||||
|
2017-01-05T00:36:04.703631903+08:00 network connect e2e1f5ceda09d4300f3a846f0acfaa9a8bb0d89e775eb744c5acecd60e0529e2 (container=0fdb...ff37, name=bridge, type=bridge)
|
||||||
|
2017-01-05T00:36:04.795031609+08:00 container start 0fdb...ff37 (image=alpine:latest, name=test)
|
||||||
|
2017-01-05T00:36:09.830268747+08:00 container kill 0fdb...ff37 (image=alpine:latest, name=test, signal=15)
|
||||||
|
2017-01-05T00:36:09.840186338+08:00 container die 0fdb...ff37 (exitCode=143, image=alpine:latest, name=test)
|
||||||
|
2017-01-05T00:36:09.880113663+08:00 network disconnect e2e...29e2 (container=0fdb...ff37, name=bridge, type=bridge)
|
||||||
|
2017-01-05T00:36:09.890214053+08:00 container stop 0fdb...ff37 (image=alpine:latest, name=test)
|
||||||
|
```
|
||||||
|
|
||||||
|
To exit the `docker events` command, use `CTRL+C`.
|
||||||
|
|
||||||
|
### Filter events by time
|
||||||
|
|
||||||
|
You can filter the output by an absolute timestamp or relative time on the host
|
||||||
|
machine, using the following different time syntaxes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker events --since 1483283804
|
||||||
|
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:36:04.703631903+08:00 network connect e2e1...29e2 (container=0fdb...ff37, name=bridge, type=bridge)
|
||||||
|
2017-01-05T00:36:04.795031609+08:00 container start 0fdb...ff37 (image=alpine:latest, name=test)
|
||||||
|
2017-01-05T00:36:09.830268747+08:00 container kill 0fdb...ff37 (image=alpine:latest, name=test, signal=15)
|
||||||
|
2017-01-05T00:36:09.840186338+08:00 container die 0fdb...ff37 (exitCode=143, image=alpine:latest, name=test)
|
||||||
|
2017-01-05T00:36:09.880113663+08:00 network disconnect e2e...29e2 (container=0fdb...ff37, name=bridge, type=bridge)
|
||||||
|
2017-01-05T00:36:09.890214053+08:00 container stop 0fdb...ff37 (image=alpine:latest, name=test)
|
||||||
|
|
||||||
|
$ docker events --since '2017-01-05'
|
||||||
|
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:36:04.703631903+08:00 network connect e2e1...29e2 (container=0fdb...ff37, name=bridge, type=bridge)
|
||||||
|
2017-01-05T00:36:04.795031609+08:00 container start 0fdb...ff37 (image=alpine:latest, name=test)
|
||||||
|
2017-01-05T00:36:09.830268747+08:00 container kill 0fdb...ff37 (image=alpine:latest, name=test, signal=15)
|
||||||
|
2017-01-05T00:36:09.840186338+08:00 container die 0fdb...ff37 (exitCode=143, image=alpine:latest, name=test)
|
||||||
|
2017-01-05T00:36:09.880113663+08:00 network disconnect e2e...29e2 (container=0fdb...ff37, name=bridge, type=bridge)
|
||||||
|
2017-01-05T00:36:09.890214053+08:00 container stop 0fdb...ff37 (image=alpine:latest, name=test)
|
||||||
|
|
||||||
|
$ docker events --since '2013-09-03T15:49:29'
|
||||||
|
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:36:04.703631903+08:00 network connect e2e1...29e2 (container=0fdb...ff37, name=bridge, type=bridge)
|
||||||
|
2017-01-05T00:36:04.795031609+08:00 container start 0fdb...ff37 (image=alpine:latest, name=test)
|
||||||
|
2017-01-05T00:36:09.830268747+08:00 container kill 0fdb...ff37 (image=alpine:latest, name=test, signal=15)
|
||||||
|
2017-01-05T00:36:09.840186338+08:00 container die 0fdb...ff37 (exitCode=143, image=alpine:latest, name=test)
|
||||||
|
2017-01-05T00:36:09.880113663+08:00 network disconnect e2e...29e2 (container=0fdb...ff37, name=bridge, type=bridge)
|
||||||
|
2017-01-05T00:36:09.890214053+08:00 container stop 0fdb...ff37 (image=alpine:latest, name=test)
|
||||||
|
|
||||||
|
$ docker events --since '10m'
|
||||||
|
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:36:04.703631903+08:00 network connect e2e1...29e2 (container=0fdb...ff37, name=bridge, type=bridge)
|
||||||
|
2017-01-05T00:36:04.795031609+08:00 container start 0fdb...ff37 (image=alpine:latest, name=test)
|
||||||
|
2017-01-05T00:36:09.830268747+08:00 container kill 0fdb...ff37 (image=alpine:latest, name=test, signal=15)
|
||||||
|
2017-01-05T00:36:09.840186338+08:00 container die 0fdb...ff37 (exitCode=143, image=alpine:latest, name=test)
|
||||||
|
2017-01-05T00:36:09.880113663+08:00 network disconnect e2e...29e2 (container=0fdb...ff37, name=bridge, type=bridge)
|
||||||
|
2017-01-05T00:36:09.890214053+08:00 container stop 0fdb...ff37 (image=alpine:latest, name=test)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Filter events by criteria
|
||||||
|
|
||||||
|
The following commands show several different ways to filter the `docker event`
|
||||||
|
output.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ 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:41:17.888104182+08:00 container stop 2a8f...4e78 (image=alpine, name=kickass_brattain)
|
||||||
|
|
||||||
|
$ docker events --filter 'image=alpine'
|
||||||
|
|
||||||
|
2017-01-05T00:41:55.784240236+08:00 container create d9cd...4d70 (image=alpine, name=happy_meitner)
|
||||||
|
2017-01-05T00:41:55.913156783+08:00 container start d9cd...4d70 (image=alpine, name=happy_meitner)
|
||||||
|
2017-01-05T00:42:01.106875249+08:00 container kill d9cd...4d70 (image=alpine, name=happy_meitner, signal=15)
|
||||||
|
2017-01-05T00:42:11.111934041+08:00 container kill d9cd...4d70 (image=alpine, name=happy_meitner, signal=9)
|
||||||
|
2017-01-05T00:42:11.119578204+08:00 container die d9cd...4d70 (exitCode=137, image=alpine, name=happy_meitner)
|
||||||
|
2017-01-05T00:42:11.173276611+08:00 container stop d9cd...4d70 (image=alpine, name=happy_meitner)
|
||||||
|
|
||||||
|
$ docker events --filter 'container=test'
|
||||||
|
|
||||||
|
2017-01-05T00:43:00.139719934+08:00 container start 0fdb...ff37 (image=alpine:latest, name=test)
|
||||||
|
2017-01-05T00:43:09.259951086+08:00 container kill 0fdb...ff37 (image=alpine:latest, name=test, signal=15)
|
||||||
|
2017-01-05T00:43:09.270102715+08:00 container die 0fdb...ff37 (exitCode=143, image=alpine:latest, name=test)
|
||||||
|
2017-01-05T00:43:09.312556440+08:00 container stop 0fdb...ff37 (image=alpine:latest, name=test)
|
||||||
|
|
||||||
|
$ docker events --filter 'container=test' --filter 'container=d9cdb1525ea8'
|
||||||
|
|
||||||
|
2017-01-05T00:44:11.517071981+08:00 container start 0fdb...ff37 (image=alpine:latest, name=test)
|
||||||
|
2017-01-05T00:44:17.685870901+08:00 container start d9cd...4d70 (image=alpine, name=happy_meitner)
|
||||||
|
2017-01-05T00:44:29.757658470+08:00 container kill 0fdb...ff37 (image=alpine:latest, name=test, signal=9)
|
||||||
|
2017-01-05T00:44:29.767718510+08:00 container die 0fdb...ff37 (exitCode=137, image=alpine:latest, name=test)
|
||||||
|
2017-01-05T00:44:29.815798344+08:00 container destroy 0fdb...ff37 (image=alpine:latest, name=test)
|
||||||
|
|
||||||
|
$ docker events --filter 'container=test' --filter 'event=stop'
|
||||||
|
|
||||||
|
2017-01-05T00:46:13.664099505+08:00 container stop a9d1...e130 (image=alpine, name=test)
|
||||||
|
|
||||||
|
$ docker events --filter 'type=volume'
|
||||||
|
|
||||||
|
2015-12-23T21:05:28.136212689Z volume create test-event-volume-local (driver=local)
|
||||||
|
2015-12-23T21:05:28.383462717Z volume mount test-event-volume-local (read/write=true, container=562f...5025, destination=/foo, driver=local, propagation=rprivate)
|
||||||
|
2015-12-23T21:05:28.650314265Z volume unmount test-event-volume-local (container=562f...5025, driver=local)
|
||||||
|
2015-12-23T21:05:28.716218405Z volume destroy test-event-volume-local (driver=local)
|
||||||
|
|
||||||
|
$ docker events --filter 'type=network'
|
||||||
|
|
||||||
|
2015-12-23T21:38:24.705709133Z network create 8b11...2c5b (name=test-event-network-local, type=bridge)
|
||||||
|
2015-12-23T21:38:25.119625123Z network connect 8b11...2c5b (name=test-event-network-local, container=b4be...c54e, type=bridge)
|
||||||
|
|
||||||
|
$ docker events --filter 'container=container_1' --filter 'container=container_2'
|
||||||
|
|
||||||
|
2014-09-03T15:49:29.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04)
|
||||||
|
2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04)
|
||||||
|
2014-05-10T17:42:14.999999999Z07:00 container die 7805c1d35632 (imager=redis:2.8)
|
||||||
|
2014-09-03T15:49:29.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
|
||||||
|
|
||||||
|
$ docker events --filter 'type=volume'
|
||||||
|
|
||||||
|
2015-12-23T21:05:28.136212689Z volume create test-event-volume-local (driver=local)
|
||||||
|
2015-12-23T21:05:28.383462717Z volume mount test-event-volume-local (read/write=true, container=562fe10671e9273da25eed36cdce26159085ac7ee6707105fd534866340a5025, destination=/foo, driver=local, propagation=rprivate)
|
||||||
|
2015-12-23T21:05:28.650314265Z volume unmount test-event-volume-local (container=562fe10671e9273da25eed36cdce26159085ac7ee6707105fd534866340a5025, driver=local)
|
||||||
|
2015-12-23T21:05:28.716218405Z volume destroy test-event-volume-local (driver=local)
|
||||||
|
|
||||||
|
$ docker events --filter 'type=network'
|
||||||
|
|
||||||
|
2015-12-23T21:38:24.705709133Z network create 8b111217944ba0ba844a65b13efcd57dc494932ee2527577758f939315ba2c5b (name=test-event-network-local, type=bridge)
|
||||||
|
2015-12-23T21:38:25.119625123Z network connect 8b111217944ba0ba844a65b13efcd57dc494932ee2527577758f939315ba2c5b (name=test-event-network-local, container=b4be644031a3d90b400f88ab3d4bdf4dc23adb250e696b6328b85441abe2c54e, type=bridge)
|
||||||
|
```
|
||||||
|
|
||||||
|
The `type=plugin` filter is experimental.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker events --filter 'type=plugin'
|
||||||
|
|
||||||
|
2016-07-25T17:30:14.825557616Z plugin pull ec7b87f2ce84330fe076e666f17dfc049d2d7ae0b8190763de94e1f2d105993f (name=tiborvass/sample-volume-plugin:latest)
|
||||||
|
2016-07-25T17:30:14.888127370Z plugin enable ec7b87f2ce84330fe076e666f17dfc049d2d7ae0b8190763de94e1f2d105993f (name=tiborvass/sample-volume-plugin:latest)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Format the output
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{% raw %}
|
||||||
|
$ docker events --filter 'type=container' --format 'Type={{.Type}} Status={{.Status}} ID={{.ID}}'
|
||||||
|
|
||||||
|
Type=container Status=create ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
||||||
|
Type=container Status=attach ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
||||||
|
Type=container Status=start ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
||||||
|
Type=container Status=resize ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
||||||
|
Type=container Status=die ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
||||||
|
Type=container Status=destroy ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Format as JSON
|
||||||
|
|
||||||
|
```none
|
||||||
|
{% raw %}
|
||||||
|
$ docker events --format '{{json .}}'
|
||||||
|
|
||||||
|
{"status":"create","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
|
||||||
|
{"status":"attach","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
|
||||||
|
{"Type":"network","Action":"connect","Actor":{"ID":"1b50a5bf755f6021dfa78e..
|
||||||
|
{"status":"start","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f42..
|
||||||
|
{"status":"resize","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
command: docker exec
|
command: docker exec
|
||||||
short: Run a command in a running container
|
short: Run a command in a running container
|
||||||
long: |
|
long: |-
|
||||||
Alias for `docker container exec`.
|
The `docker exec` command runs a new command in a running container.
|
||||||
|
|
||||||
|
The command started using `docker exec` only runs while the container's primary
|
||||||
|
process (`PID 1`) is running, and it is not restarted if the container is
|
||||||
|
restarted.
|
||||||
usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
|
usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -30,3 +34,53 @@ options:
|
||||||
- option: user
|
- option: user
|
||||||
shorthand: u
|
shorthand: u
|
||||||
description: 'Username or UID (format: <name|uid>[:<group|gid>])'
|
description: 'Username or UID (format: <name|uid>[:<group|gid>])'
|
||||||
|
example: |-
|
||||||
|
### Run `docker exec` on a running container
|
||||||
|
|
||||||
|
First, start a container.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker run --name ubuntu_bash --rm -i -t ubuntu bash
|
||||||
|
```
|
||||||
|
|
||||||
|
This will create a container named `ubuntu_bash` and start a Bash session.
|
||||||
|
|
||||||
|
Next, execute a command on the container.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker exec -d ubuntu_bash touch /tmp/execWorks
|
||||||
|
```
|
||||||
|
|
||||||
|
This will create a new file `/tmp/execWorks` inside the running container
|
||||||
|
`ubuntu_bash`, in the background.
|
||||||
|
|
||||||
|
Next, execute an interactive `bash` shell on the container.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker exec -it ubuntu_bash bash
|
||||||
|
```
|
||||||
|
|
||||||
|
This will create a new Bash session in the container `ubuntu_bash`.
|
||||||
|
|
||||||
|
### Try to run `docker exec` on a paused container
|
||||||
|
|
||||||
|
If the container is paused, then the `docker exec` command will fail with an error:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker pause test
|
||||||
|
|
||||||
|
test
|
||||||
|
|
||||||
|
$ docker ps
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
1ae3b36715d2 ubuntu:latest "bash" 17 seconds ago Up 16 seconds (Paused) test
|
||||||
|
|
||||||
|
$ docker exec test ls
|
||||||
|
|
||||||
|
FATA[0000] Error response from daemon: Container test is paused, unpause the container before exec
|
||||||
|
|
||||||
|
$ echo $?
|
||||||
|
1
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
command: docker export
|
command: docker export
|
||||||
short: Export a container's filesystem as a tar archive
|
short: Export a container's filesystem as a tar archive
|
||||||
long: |
|
long: |-
|
||||||
Alias for `docker container export`.
|
The `docker export` command does not export the contents of volumes associated
|
||||||
|
with the container. If a volume is mounted on top of an existing directory in
|
||||||
|
the container, `docker export` will export the contents of the *underlying*
|
||||||
|
directory, not the contents of the volume.
|
||||||
|
|
||||||
|
Refer to [Backup, restore, or migrate data volumes](https://docs.docker.com/engine/tutorials/dockervolumes/#backup-restore-or-migrate-data-volumes)
|
||||||
|
in the user guide for examples on exporting data in a volume.
|
||||||
usage: docker export [OPTIONS] CONTAINER
|
usage: docker export [OPTIONS] CONTAINER
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -9,3 +15,14 @@ options:
|
||||||
- option: output
|
- option: output
|
||||||
shorthand: o
|
shorthand: o
|
||||||
description: Write to a file, instead of STDOUT
|
description: Write to a file, instead of STDOUT
|
||||||
|
example: |-
|
||||||
|
ch of these commands has the same result.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker export red_panda > latest.tar
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker export --output="latest.tar" red_panda
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
command: docker history
|
command: docker history
|
||||||
short: Show the history of an image
|
short: Show the history of an image
|
||||||
long: |
|
long: Show the history of an image
|
||||||
Alias for `docker image history`.
|
|
||||||
usage: docker history [OPTIONS] IMAGE
|
usage: docker history [OPTIONS] IMAGE
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -17,3 +16,29 @@ options:
|
||||||
shorthand: q
|
shorthand: q
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Only show numeric IDs
|
description: Only show numeric IDs
|
||||||
|
example: |-
|
||||||
|
To see how the `docker:latest` image was built:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker history docker
|
||||||
|
|
||||||
|
IMAGE CREATED CREATED BY SIZE COMMENT
|
||||||
|
3e23a5875458 8 days ago /bin/sh -c #(nop) ENV LC_ALL=C.UTF-8 0 B
|
||||||
|
8578938dd170 8 days ago /bin/sh -c dpkg-reconfigure locales && loc 1.245 MB
|
||||||
|
be51b77efb42 8 days ago /bin/sh -c apt-get update && apt-get install 338.3 MB
|
||||||
|
4b137612be55 6 weeks ago /bin/sh -c #(nop) ADD jessie.tar.xz in / 121 MB
|
||||||
|
750d58736b4b 6 weeks ago /bin/sh -c #(nop) MAINTAINER Tianon Gravi <ad 0 B
|
||||||
|
511136ea3c5a 9 months ago 0 B Imported from -
|
||||||
|
```
|
||||||
|
|
||||||
|
To see how the `docker:apache` image was added to a container's base image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker history docker:scm
|
||||||
|
IMAGE CREATED CREATED BY SIZE COMMENT
|
||||||
|
2ac9d1098bf1 3 months ago /bin/bash 241.4 MB Added Apache to Fedora base image
|
||||||
|
88b42ffd1f7c 5 months ago /bin/sh -c #(nop) ADD file:1fd8d7f9f6557cafc7 373.7 MB
|
||||||
|
c69cab00d6ef 5 months ago /bin/sh -c #(nop) MAINTAINER Lokesh Mandvekar 0 B
|
||||||
|
511136ea3c5a 19 months ago 0 B Imported from -
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -30,3 +30,4 @@ clink:
|
||||||
- docker_image_rm.yaml
|
- docker_image_rm.yaml
|
||||||
- docker_image_save.yaml
|
- docker_image_save.yaml
|
||||||
- docker_image_tag.yaml
|
- docker_image_tag.yaml
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
command: docker image build
|
command: docker image build
|
||||||
short: Build an image from a Dockerfile
|
short: Build an image from a Dockerfile
|
||||||
long: |
|
long: Build an image from a Dockerfile
|
||||||
Alias for `docker build`.
|
|
||||||
usage: docker image build [OPTIONS] PATH | URL | -
|
usage: docker image build [OPTIONS] PATH | URL | -
|
||||||
pname: docker image
|
pname: docker image
|
||||||
plink: docker_image.yaml
|
plink: docker_image.yaml
|
||||||
|
@ -72,7 +71,8 @@ options:
|
||||||
default_value: '[]'
|
default_value: '[]'
|
||||||
description: Security options
|
description: Security options
|
||||||
- option: shm-size
|
- option: shm-size
|
||||||
description: Size of /dev/shm, default value is 64MB
|
default_value: "0"
|
||||||
|
description: Size of /dev/shm
|
||||||
- option: squash
|
- option: squash
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Squash newly built layers into a single new layer
|
description: Squash newly built layers into a single new layer
|
||||||
|
@ -83,3 +83,4 @@ options:
|
||||||
- option: ulimit
|
- option: ulimit
|
||||||
default_value: '[]'
|
default_value: '[]'
|
||||||
description: Ulimit options
|
description: Ulimit options
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,6 @@
|
||||||
command: docker image history
|
command: docker image history
|
||||||
short: Show the history of an image
|
short: Show the history of an image
|
||||||
long: "Show the history of when and how an image was created.\n\n# EXAMPLES\n $
|
long: Show the history of an image
|
||||||
docker history fedora\n IMAGE CREATED CREATED BY SIZE
|
|
||||||
\ COMMENT\n 105182bb5e8b 5 days ago /bin/sh -c #(nop) ADD
|
|
||||||
file:71356d2ad59aa3119d 372.7 MB\n 73bd853d2ea5 13 days ago /bin/sh
|
|
||||||
-c #(nop) MAINTAINER Lokesh Mandvekar 0 B\n 511136ea3c5a 10 months ago 0
|
|
||||||
B Imported from -\n\n## Display comments in the image history\nThe
|
|
||||||
`docker commit` command has a **-m** flag for adding comments to the image. These
|
|
||||||
comments will be displayed in the image history.\n\n $ sudo docker history docker:scm\n
|
|
||||||
\ IMAGE CREATED CREATED BY SIZE
|
|
||||||
\ COMMENT\n 2ac9d1098bf1 3 months ago /bin/bash 241.4
|
|
||||||
MB Added Apache to Fedora base image\n 88b42ffd1f7c 5 months
|
|
||||||
ago /bin/sh -c #(nop) ADD file:1fd8d7f9f6557cafc7 373.7 MB \n
|
|
||||||
\ c69cab00d6ef 5 months ago /bin/sh -c #(nop) MAINTAINER Lokesh
|
|
||||||
Mandvekar 0 B \n 511136ea3c5a 19 months ago 0
|
|
||||||
B Imported from -\n"
|
|
||||||
usage: docker image history [OPTIONS] IMAGE
|
usage: docker image history [OPTIONS] IMAGE
|
||||||
pname: docker image
|
pname: docker image
|
||||||
plink: docker_image.yaml
|
plink: docker_image.yaml
|
||||||
|
@ -30,3 +16,4 @@ options:
|
||||||
shorthand: q
|
shorthand: q
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Only show numeric IDs
|
description: Only show numeric IDs
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,6 @@
|
||||||
command: docker image import
|
command: docker image import
|
||||||
short: Import the contents from a tarball to create a filesystem image
|
short: Import the contents from a tarball to create a filesystem image
|
||||||
long: "Create a new filesystem image from the contents of a tarball (`.tar`,\n`.tar.gz`,
|
long: Import the contents from a tarball to create a filesystem image
|
||||||
`.tgz`, `.bzip`, `.tar.xz`, `.txz`) into it, then optionally tag it.\n\n\n# EXAMPLES\n\n##
|
|
||||||
Import from a remote location\n\n # docker image import http://example.com/exampleimage.tgz
|
|
||||||
example/imagerepo\n\n## Import from a local file\n\nImport to docker via pipe and
|
|
||||||
stdin:\n\n # cat exampleimage.tgz | docker image import - example/imagelocal\n\nImport
|
|
||||||
with a commit message. \n\n # cat exampleimage.tgz | docker image import --message
|
|
||||||
\"New image imported from tarball\" - exampleimagelocal:new\n\nImport to a Docker
|
|
||||||
image from a local file.\n\n # docker image import /path/to/exampleimage.tgz
|
|
||||||
\n\n\n## Import from a local file and tag\n\nImport to docker via pipe and stdin:\n\n
|
|
||||||
\ # cat exampleimageV2.tgz | docker image import - example/imagelocal:V-2.0\n\n##
|
|
||||||
Import from a local directory\n\n # tar -c . | docker image import - exampleimagedir\n\n##
|
|
||||||
Apply specified Dockerfile instructions while importing the image\nThis example
|
|
||||||
sets the docker image ENV variable DEBUG to true by default.\n\n # tar -c . |
|
|
||||||
docker image import -c=\"ENV DEBUG true\" - exampleimagedir\n\n# See also\n**docker-export(1)**
|
|
||||||
to export the contents of a filesystem as a tar archive to STDOUT.\n"
|
|
||||||
usage: docker image import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]
|
usage: docker image import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]
|
||||||
pname: docker image
|
pname: docker image
|
||||||
plink: docker_image.yaml
|
plink: docker_image.yaml
|
||||||
|
@ -26,3 +12,4 @@ options:
|
||||||
- option: message
|
- option: message
|
||||||
shorthand: m
|
shorthand: m
|
||||||
description: Set commit message for imported image
|
description: Set commit message for imported image
|
||||||
|
|
||||||
|
|
|
@ -8,3 +8,4 @@ options:
|
||||||
- option: format
|
- option: format
|
||||||
shorthand: f
|
shorthand: f
|
||||||
description: Format the output using the given Go template
|
description: Format the output using the given Go template
|
||||||
|
|
||||||
|
|
|
@ -1,31 +1,6 @@
|
||||||
command: docker image load
|
command: docker image load
|
||||||
short: Load an image from a tar archive or STDIN
|
short: Load an image from a tar archive or STDIN
|
||||||
long: |
|
long: Load an image from a tar archive or STDIN
|
||||||
Loads a tarred repository from a file or the standard input stream.
|
|
||||||
Restores both images and tags. Write image names or IDs imported it
|
|
||||||
standard output stream.
|
|
||||||
|
|
||||||
# EXAMPLES
|
|
||||||
|
|
||||||
$ docker images
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
|
||||||
busybox latest 769b9341d937 7 weeks ago 2.489 MB
|
|
||||||
$ docker load --input fedora.tar
|
|
||||||
# […]
|
|
||||||
Loaded image: fedora:rawhide
|
|
||||||
# […]
|
|
||||||
Loaded image: fedora:20
|
|
||||||
# […]
|
|
||||||
$ docker images
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
|
||||||
busybox latest 769b9341d937 7 weeks ago 2.489 MB
|
|
||||||
fedora rawhide 0d20aec6529d 7 weeks ago 387 MB
|
|
||||||
fedora 20 58394af37342 7 weeks ago 385.5 MB
|
|
||||||
fedora heisenbug 58394af37342 7 weeks ago 385.5 MB
|
|
||||||
fedora latest 58394af37342 7 weeks ago 385.5 MB
|
|
||||||
|
|
||||||
# See also
|
|
||||||
**docker-image-save(1)** to save one or more images to a tar archive (streamed to STDOUT by default).
|
|
||||||
usage: docker image load [OPTIONS]
|
usage: docker image load [OPTIONS]
|
||||||
pname: docker image
|
pname: docker image
|
||||||
plink: docker_image.yaml
|
plink: docker_image.yaml
|
||||||
|
@ -37,3 +12,4 @@ options:
|
||||||
shorthand: q
|
shorthand: q
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Suppress the load output
|
description: Suppress the load output
|
||||||
|
|
||||||
|
|
|
@ -1,60 +1,7 @@
|
||||||
command: docker image ls
|
command: docker image ls
|
||||||
aliases: images, list
|
aliases: images, list
|
||||||
short: List images
|
short: List images
|
||||||
long: "This command lists the images stored in the local Docker repository.\n\nBy
|
long: List images
|
||||||
default, intermediate images, used during builds, are not listed. Some of the\noutput,
|
|
||||||
e.g., image ID, is truncated, for space reasons. However the truncated\nimage ID,
|
|
||||||
and often the first few characters, are enough to be used in other\nDocker commands
|
|
||||||
that use the image ID. The output includes repository, tag, image\nID, date created
|
|
||||||
and the virtual size.\n\nThe title REPOSITORY for the first title may seem confusing.
|
|
||||||
It is essentially\nthe image name. However, because you can tag a specific image,
|
|
||||||
and multiple tags\n(image instances) can be associated with a single name, the name
|
|
||||||
is really a\nrepository for all tagged images of the same name. For example consider
|
|
||||||
an image\ncalled fedora. It may be tagged with 18, 19, or 20, etc. to manage different\nversions.\n\n##
|
|
||||||
Filters\n\nFilters the output based on these conditions:\n\n - dangling=(true|false)
|
|
||||||
- find unused images\n - label=<key> or label=<key>=<value>\n - before=(<image-name>[:tag]|<image-id>|<image@digest>)\n
|
|
||||||
\ - since=(<image-name>[:tag]|<image-id>|<image@digest>)\n\n## Format\n\n Pretty-print
|
|
||||||
images using a Go template.\n Valid placeholders:\n .ID - Image ID\n .Repository
|
|
||||||
- Image repository\n .Tag - Image tag\n .Digest - Image digest\n .CreatedSince
|
|
||||||
- Elapsed time since the image was created\n .CreatedAt - Time when the image
|
|
||||||
was created\n .Size - Image disk size\n\n# EXAMPLES\n\n## Listing the images\n\nTo
|
|
||||||
list the images in a local repository (not the registry) run:\n\n docker image
|
|
||||||
ls\n\nThe list will contain the image repository name, a tag for the image, and
|
|
||||||
an\nimage ID, when it was created and its virtual size. Columns: REPOSITORY, TAG,\nIMAGE
|
|
||||||
ID, CREATED, and SIZE.\n\nThe `docker image ls` command takes an optional `[REPOSITORY[:TAG]]`
|
|
||||||
argument\nthat restricts the list to images that match the argument. If you specify\n`REPOSITORY`but
|
|
||||||
no `TAG`, the `docker image ls` command lists all images in the\ngiven repository.\n\n
|
|
||||||
\ docker image ls java\n\nThe `[REPOSITORY[:TAG]]` value must be an \"exact match\".
|
|
||||||
This means that, for example,\n`docker image ls jav` does not match the image `java`.\n\nIf
|
|
||||||
both `REPOSITORY` and `TAG` are provided, only images matching that\nrepository
|
|
||||||
and tag are listed. To find all local images in the \"java\"\nrepository with tag
|
|
||||||
\"8\" you can use:\n\n docker image ls java:8\n\nTo get a verbose list of images
|
|
||||||
which contains all the intermediate images\nused in builds use **-a**:\n\n docker
|
|
||||||
image ls -a\n\nPreviously, the docker image ls command supported the --tree and
|
|
||||||
--dot arguments,\nwhich displayed different visualizations of the image data. Docker
|
|
||||||
core removed\nthis functionality in the 1.7 version. If you liked this functionality,
|
|
||||||
you can\nstill find it in the third-party dockviz tool: https://github.com/justone/dockviz.\n\n##
|
|
||||||
Listing images in a desired format\n\nWhen using the --format option, the image
|
|
||||||
command will either output the data \nexactly as the template declares or, when
|
|
||||||
using the `table` directive, will \ninclude column headers as well. You can use
|
|
||||||
special characters like `\\t` for\ninserting tab spacing between columns. \n\nThe
|
|
||||||
following example uses a template without headers and outputs the ID and \nRepository
|
|
||||||
entries separated by a colon for all images:\n\n docker images --format \"{{.ID}}:
|
|
||||||
{{.Repository}}\"\n 77af4d6b9913: <none>\n b6fa739cedf5: committ\n 78a85c484bad:
|
|
||||||
ipbabble\n 30557a29d5ab: docker\n 5ed6274db6ce: <none>\n 746b819f315e:
|
|
||||||
postgres\n 746b819f315e: postgres\n 746b819f315e: postgres\n 746b819f315e:
|
|
||||||
postgres\n\nTo list all images with their repository and tag in a table format you
|
|
||||||
can use:\n\n docker images --format \"table {{.ID}}\\t{{.Repository}}\\t{{.Tag}}\"\n
|
|
||||||
\ IMAGE ID REPOSITORY TAG\n 77af4d6b9913 <none>
|
|
||||||
\ <none>\n b6fa739cedf5 committ latest\n
|
|
||||||
\ 78a85c484bad ipbabble <none>\n 30557a29d5ab docker
|
|
||||||
\ latest\n 5ed6274db6ce <none> <none>\n
|
|
||||||
\ 746b819f315e postgres 9\n 746b819f315e postgres
|
|
||||||
\ 9.3\n 746b819f315e postgres 9.3.5\n
|
|
||||||
\ 746b819f315e postgres latest\n\nValid template placeholders
|
|
||||||
are listed above.\n\n## Listing only the shortened image IDs\n\nListing just the
|
|
||||||
shortened image IDs. This can be useful for some automated\ntools.\n\n docker
|
|
||||||
image ls -q\n"
|
|
||||||
usage: docker image ls [OPTIONS] [REPOSITORY[:TAG]]
|
usage: docker image ls [OPTIONS] [REPOSITORY[:TAG]]
|
||||||
pname: docker image
|
pname: docker image
|
||||||
plink: docker_image.yaml
|
plink: docker_image.yaml
|
||||||
|
@ -78,3 +25,4 @@ options:
|
||||||
shorthand: q
|
shorthand: q
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Only show numeric IDs
|
description: Only show numeric IDs
|
||||||
|
|
||||||
|
|
|
@ -15,3 +15,4 @@ options:
|
||||||
shorthand: f
|
shorthand: f
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Do not prompt for confirmation
|
description: Do not prompt for confirmation
|
||||||
|
|
||||||
|
|
|
@ -1,99 +1,6 @@
|
||||||
command: docker image pull
|
command: docker image pull
|
||||||
short: Pull an image or a repository from a registry
|
short: Pull an image or a repository from a registry
|
||||||
long: "This command pulls down an image or a repository from a registry. If\nthere
|
long: Pull an image or a repository from a registry
|
||||||
is more than one image for a repository (e.g., fedora) then all\nimages for that
|
|
||||||
repository name can be pulled down including any tags\n(see the option **-a** or
|
|
||||||
**--all-tags**).\n\nIf you do not specify a `REGISTRY_HOST`, the command uses Docker's
|
|
||||||
public\nregistry located at `registry-1.docker.io` by default. \n\n# EXAMPLES\n\n###
|
|
||||||
Pull an image from Docker Hub\n\nTo download a particular image, or set of images
|
|
||||||
(i.e., a repository), use\n`docker image pull`. If no tag is provided, Docker Engine
|
|
||||||
uses the `:latest` tag as a\ndefault. This command pulls the `debian:latest` image:\n\n
|
|
||||||
\ $ docker image pull debian\n\n Using default tag: latest\n latest: Pulling
|
|
||||||
from library/debian\n fdd5d7827f33: Pull complete\n a3ed95caeb02: Pull complete\n
|
|
||||||
\ Digest: sha256:e7d38b3517548a1c71e41bffe9c8ae6d6d29546ce46bf62159837aad072c90aa\n
|
|
||||||
\ Status: Downloaded newer image for debian:latest\n\nDocker images can consist
|
|
||||||
of multiple layers. In the example above, the image\nconsists of two layers; `fdd5d7827f33`
|
|
||||||
and `a3ed95caeb02`.\n\nLayers can be reused by images. For example, the `debian:jessie`
|
|
||||||
image shares\nboth layers with `debian:latest`. Pulling the `debian:jessie` image
|
|
||||||
therefore\nonly pulls its metadata, but not its layers, because all layers are already\npresent
|
|
||||||
locally:\n\n $ docker image pull debian:jessie\n\n jessie: Pulling from library/debian\n
|
|
||||||
\ fdd5d7827f33: Already exists\n a3ed95caeb02: Already exists\n Digest:
|
|
||||||
sha256:a9c958be96d7d40df920e7041608f2f017af81800ca5ad23e327bc402626b58e\n Status:
|
|
||||||
Downloaded newer image for debian:jessie\n\nTo see which images are present locally,
|
|
||||||
use the **docker-images(1)**\ncommand:\n\n $ docker images\n\n REPOSITORY
|
|
||||||
\ TAG IMAGE ID CREATED SIZE\n debian jessie f50f9524513f
|
|
||||||
\ 5 days ago 125.1 MB\n debian latest f50f9524513f 5 days ago
|
|
||||||
\ 125.1 MB\n\nDocker uses a content-addressable image store, and the image ID is
|
|
||||||
a SHA256\ndigest covering the image's configuration and layers. In the example above,\n`debian:jessie`
|
|
||||||
and `debian:latest` have the same image ID because they are\nactually the *same*
|
|
||||||
image tagged with different names. Because they are the\nsame image, their layers
|
|
||||||
are stored only once and do not consume extra disk\nspace.\n\nFor more information
|
|
||||||
about images, layers, and the content-addressable store,\nrefer to [understand images,
|
|
||||||
containers, and storage drivers](https://docs.docker.com/engine/userguide/storagedriver/imagesandcontainers/)\nin
|
|
||||||
the online documentation.\n\n\n## Pull an image by digest (immutable identifier)\n\nSo
|
|
||||||
far, you've pulled images by their name (and \"tag\"). Using names and tags is\na
|
|
||||||
convenient way to work with images. When using tags, you can `docker image pull`
|
|
||||||
an\nimage again to make sure you have the most up-to-date version of that image.\nFor
|
|
||||||
example, `docker image pull ubuntu:14.04` pulls the latest version of the Ubuntu\n14.04
|
|
||||||
image.\n\nIn some cases you don't want images to be updated to newer versions, but
|
|
||||||
prefer\nto use a fixed version of an image. Docker enables you to pull an image
|
|
||||||
by its\n*digest*. When pulling an image by digest, you specify *exactly* which version\nof
|
|
||||||
an image to pull. Doing so, allows you to \"pin\" an image to that version,\nand
|
|
||||||
guarantee that the image you're using is always the same.\n\nTo know the digest
|
|
||||||
of an image, pull the image first. Let's pull the latest\n`ubuntu:14.04` image from
|
|
||||||
Docker Hub:\n\n $ docker image pull ubuntu:14.04\n\n 14.04: Pulling from library/ubuntu\n
|
|
||||||
\ 5a132a7e7af1: Pull complete\n fd2731e4c50c: Pull complete\n 28a2f68d1120:
|
|
||||||
Pull complete\n a3ed95caeb02: Pull complete\n Digest: sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2\n
|
|
||||||
\ Status: Downloaded newer image for ubuntu:14.04\n\nDocker prints the digest
|
|
||||||
of the image after the pull has finished. In the example\nabove, the digest of the
|
|
||||||
image is:\n\n sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2\n\nDocker
|
|
||||||
also prints the digest of an image when *pushing* to a registry. This\nmay be useful
|
|
||||||
if you want to pin to a version of the image you just pushed.\n\nA digest takes
|
|
||||||
the place of the tag when pulling an image, for example, to \npull the above image
|
|
||||||
by digest, run the following command:\n\n $ docker image pull ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2\n\n
|
|
||||||
\ sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2: Pulling
|
|
||||||
from library/ubuntu\n 5a132a7e7af1: Already exists\n fd2731e4c50c: Already
|
|
||||||
exists\n 28a2f68d1120: Already exists\n a3ed95caeb02: Already exists\n Digest:
|
|
||||||
sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2\n Status:
|
|
||||||
Downloaded newer image for ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2\n\nDigest
|
|
||||||
can also be used in the `FROM` of a Dockerfile, for example:\n\n FROM ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2\n
|
|
||||||
\ MAINTAINER some maintainer <maintainer@example.com>\n\n> **Note**: Using this
|
|
||||||
feature \"pins\" an image to a specific version in time.\n> Docker will therefore
|
|
||||||
not pull updated versions of an image, which may include \n> security updates. If
|
|
||||||
you want to pull an updated image, you need to change the\n> digest accordingly.\n\n##
|
|
||||||
Pulling from a different registry\n\nBy default, `docker image pull` pulls images
|
|
||||||
from Docker Hub. It is also possible to\nmanually specify the path of a registry
|
|
||||||
to pull from. For example, if you have\nset up a local registry, you can specify
|
|
||||||
its path to pull from it. A registry\npath is similar to a URL, but does not contain
|
|
||||||
a protocol specifier (`https://`).\n\nThe following command pulls the `testing/test-image`
|
|
||||||
image from a local registry\nlistening on port 5000 (`myregistry.local:5000`):\n\n
|
|
||||||
\ $ docker image pull myregistry.local:5000/testing/test-image\n\nRegistry credentials
|
|
||||||
are managed by **docker-login(1)**.\n\nDocker uses the `https://` protocol to communicate
|
|
||||||
with a registry, unless the\nregistry is allowed to be accessed over an insecure
|
|
||||||
connection. Refer to the\n[insecure registries](https://docs.docker.com/engine/reference/commandline/daemon/#insecure-registries)\nsection
|
|
||||||
in the online documentation for more information.\n\n\n## Pull a repository with
|
|
||||||
multiple images\n\nBy default, `docker image pull` pulls a *single* image from the
|
|
||||||
registry. A repository\ncan contain multiple images. To pull all images from a repository,
|
|
||||||
provide the\n`-a` (or `--all-tags`) option when using `docker image pull`.\n\nThis
|
|
||||||
command pulls all images from the `fedora` repository:\n\n $ docker image pull
|
|
||||||
--all-tags fedora\n\n Pulling repository fedora\n ad57ef8d78d7: Download complete\n
|
|
||||||
\ 105182bb5e8b: Download complete\n 511136ea3c5a: Download complete\n 73bd853d2ea5:
|
|
||||||
Download complete\n ....\n\n Status: Downloaded newer image for fedora\n\nAfter
|
|
||||||
the pull has completed use the `docker images` command to see the\nimages that were
|
|
||||||
pulled. The example below shows all the `fedora` images\nthat are present locally:\n\n
|
|
||||||
\ $ docker images fedora\n\n REPOSITORY TAG IMAGE ID CREATED
|
|
||||||
\ SIZE\n fedora rawhide ad57ef8d78d7 5 days ago 359.3 MB\n
|
|
||||||
\ fedora 20 105182bb5e8b 5 days ago 372.7 MB\n fedora heisenbug
|
|
||||||
\ 105182bb5e8b 5 days ago 372.7 MB\n fedora latest 105182bb5e8b
|
|
||||||
\ 5 days ago 372.7 MB\n\n\n## Canceling a pull\n\nKilling the `docker image
|
|
||||||
pull` process, for example by pressing `CTRL-c` while it is\nrunning in a terminal,
|
|
||||||
will terminate the pull operation.\n\n $ docker image pull fedora\n\n Using
|
|
||||||
default tag: latest\n latest: Pulling from library/fedora\n a3ed95caeb02:
|
|
||||||
Pulling fs layer\n 236608c7b546: Pulling fs layer\n ^C\n\n> **Note**: Technically,
|
|
||||||
the Engine terminates a pull operation when the\n> connection between the Docker
|
|
||||||
Engine daemon and the Docker Engine client\n> initiating the pull is lost. If the
|
|
||||||
connection with the Engine daemon is\n> lost for other reasons than a manual interaction,
|
|
||||||
the pull is also aborted.\n"
|
|
||||||
usage: docker image pull [OPTIONS] NAME[:TAG|@DIGEST]
|
usage: docker image pull [OPTIONS] NAME[:TAG|@DIGEST]
|
||||||
pname: docker image
|
pname: docker image
|
||||||
plink: docker_image.yaml
|
plink: docker_image.yaml
|
||||||
|
@ -105,3 +12,4 @@ options:
|
||||||
- option: disable-content-trust
|
- option: disable-content-trust
|
||||||
default_value: "true"
|
default_value: "true"
|
||||||
description: Skip image verification
|
description: Skip image verification
|
||||||
|
|
||||||
|
|
|
@ -1,40 +1,6 @@
|
||||||
command: docker image push
|
command: docker image push
|
||||||
short: Push an image or a repository to a registry
|
short: Push an image or a repository to a registry
|
||||||
long: |
|
long: Push an image or a repository to a registry
|
||||||
Use `docker image push` to share your images to the [Docker Hub](https://hub.docker.com)
|
|
||||||
registry or to a self-hosted one.
|
|
||||||
|
|
||||||
Refer to **docker-image-tag(1)** for more information about valid image and tag names.
|
|
||||||
|
|
||||||
Killing the **docker image push** process, for example by pressing **CTRL-c** while it
|
|
||||||
is running in a terminal, terminates the push operation.
|
|
||||||
|
|
||||||
Registry credentials are managed by **docker-login(1)**.
|
|
||||||
|
|
||||||
# EXAMPLES
|
|
||||||
|
|
||||||
## Pushing a new image to a registry
|
|
||||||
|
|
||||||
First save the new image by finding the container ID (using **docker container ls**)
|
|
||||||
and then committing it to a new image name. Note that only a-z0-9-_. are
|
|
||||||
allowed when naming images:
|
|
||||||
|
|
||||||
# docker container commit c16378f943fe rhel-httpd
|
|
||||||
|
|
||||||
Now, push the image to the registry using the image ID. In this example the
|
|
||||||
registry is on host named `registry-host` and listening on port `5000`. To do
|
|
||||||
this, tag the image with the host name or IP address, and the port of the
|
|
||||||
registry:
|
|
||||||
|
|
||||||
# docker image tag rhel-httpd registry-host:5000/myadmin/rhel-httpd
|
|
||||||
# docker image push registry-host:5000/myadmin/rhel-httpd
|
|
||||||
|
|
||||||
Check that this worked by running:
|
|
||||||
|
|
||||||
# docker image ls
|
|
||||||
|
|
||||||
You should see both `rhel-httpd` and `registry-host:5000/myadmin/rhel-httpd`
|
|
||||||
listed.
|
|
||||||
usage: docker image push [OPTIONS] NAME[:TAG]
|
usage: docker image push [OPTIONS] NAME[:TAG]
|
||||||
pname: docker image
|
pname: docker image
|
||||||
plink: docker_image.yaml
|
plink: docker_image.yaml
|
||||||
|
@ -42,3 +8,4 @@ options:
|
||||||
- option: disable-content-trust
|
- option: disable-content-trust
|
||||||
default_value: "true"
|
default_value: "true"
|
||||||
description: Skip image signing
|
description: Skip image signing
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,7 @@
|
||||||
command: docker image rm
|
command: docker image rm
|
||||||
aliases: rmi, remove
|
aliases: rmi, remove
|
||||||
short: Remove one or more images
|
short: Remove one or more images
|
||||||
long: |
|
long: Remove one or more images
|
||||||
Removes one or more images from the host node. This does not remove images from
|
|
||||||
a registry. You cannot remove an image of a running container unless you use the
|
|
||||||
**-f** option. To see all images on a host use the **docker image ls** command.
|
|
||||||
|
|
||||||
# EXAMPLES
|
|
||||||
|
|
||||||
## Removing an image
|
|
||||||
|
|
||||||
Here is an example of removing an image:
|
|
||||||
|
|
||||||
docker image rm fedora/httpd
|
|
||||||
usage: docker image rm [OPTIONS] IMAGE [IMAGE...]
|
usage: docker image rm [OPTIONS] IMAGE [IMAGE...]
|
||||||
pname: docker image
|
pname: docker image
|
||||||
plink: docker_image.yaml
|
plink: docker_image.yaml
|
||||||
|
@ -24,3 +13,4 @@ options:
|
||||||
- option: no-prune
|
- option: no-prune
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Do not delete untagged parents
|
description: Do not delete untagged parents
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,6 @@
|
||||||
command: docker image save
|
command: docker image save
|
||||||
short: Save one or more images to a tar archive (streamed to STDOUT by default)
|
short: Save one or more images to a tar archive (streamed to STDOUT by default)
|
||||||
long: |
|
long: Save one or more images to a tar archive (streamed to STDOUT by default)
|
||||||
Produces a tarred repository to the standard output stream. Contains all
|
|
||||||
parent layers, and all tags + versions, or specified repo:tag.
|
|
||||||
|
|
||||||
Stream to a file instead of STDOUT by using **-o**.
|
|
||||||
|
|
||||||
# EXAMPLES
|
|
||||||
|
|
||||||
Save all fedora repository images to a fedora-all.tar and save the latest
|
|
||||||
fedora image to a fedora-latest.tar:
|
|
||||||
|
|
||||||
$ docker image save fedora > fedora-all.tar
|
|
||||||
$ docker image save --output=fedora-latest.tar fedora:latest
|
|
||||||
$ ls -sh fedora-all.tar
|
|
||||||
721M fedora-all.tar
|
|
||||||
$ ls -sh fedora-latest.tar
|
|
||||||
367M fedora-latest.tar
|
|
||||||
|
|
||||||
# See also
|
|
||||||
**docker-image-load(1)** to load an image from a tar archive on STDIN.
|
|
||||||
usage: docker image save [OPTIONS] IMAGE [IMAGE...]
|
usage: docker image save [OPTIONS] IMAGE [IMAGE...]
|
||||||
pname: docker image
|
pname: docker image
|
||||||
plink: docker_image.yaml
|
plink: docker_image.yaml
|
||||||
|
@ -27,3 +8,4 @@ options:
|
||||||
- option: output
|
- option: output
|
||||||
shorthand: o
|
shorthand: o
|
||||||
description: Write to a file, instead of STDOUT
|
description: Write to a file, instead of STDOUT
|
||||||
|
|
||||||
|
|
|
@ -1,31 +1,7 @@
|
||||||
command: docker image tag
|
command: docker image tag
|
||||||
short: Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
|
short: Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
|
||||||
long: "Assigns a new alias to an image in a registry. An alias refers to the\nentire
|
long: Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
|
||||||
image name including the optional `TAG` after the ':'. \n\n# OPTIONS\n**NAME**\n
|
|
||||||
\ The image name which is made up of slash-separated name components, \n optionally
|
|
||||||
prefixed by a registry hostname. The hostname must comply with \n standard DNS
|
|
||||||
rules, but may not contain underscores. If a hostname is \n present, it may optionally
|
|
||||||
be followed by a port number in the format \n `:8080`. If not present, the command
|
|
||||||
uses Docker's public registry located at\n `registry-1.docker.io` by default.
|
|
||||||
Name components may contain lowercase \n letters, digits and separators. A separator
|
|
||||||
is defined as a period, one or\n two underscores, or one or more dashes. A name
|
|
||||||
component may not start or end \n with a separator.\n\n**TAG**\n The tag assigned
|
|
||||||
to the image to version and distinguish images with the same\n name. The tag name
|
|
||||||
must be valid ASCII and may contain lowercase and\n uppercase letters, digits,
|
|
||||||
underscores, periods and hyphens. A tag name\n may not start with a period or
|
|
||||||
a hyphen and may contain a maximum of 128\n characters.\n\n# EXAMPLES\n\n## Tagging
|
|
||||||
an image referenced by ID\n\nTo tag a local image with ID \"0e5574283393\" into
|
|
||||||
the \"fedora\" repository with \n\"version1.0\":\n\n docker image tag 0e5574283393
|
|
||||||
fedora/httpd:version1.0\n\n## Tagging an image referenced by Name\n\nTo tag a local
|
|
||||||
image with name \"httpd\" into the \"fedora\" repository with \n\"version1.0\":\n\n
|
|
||||||
\ docker image tag httpd fedora/httpd:version1.0\n\nNote that since the tag name
|
|
||||||
is not specified, the alias is created for an\nexisting local version `httpd:latest`.\n\n##
|
|
||||||
Tagging an image referenced by Name and Tag\n\nTo tag a local image with name \"httpd\"
|
|
||||||
and tag \"test\" into the \"fedora\"\nrepository with \"version1.0.test\":\n\n docker
|
|
||||||
image tag httpd:test fedora/httpd:version1.0.test\n\n## Tagging an image for a private
|
|
||||||
repository\n\nTo push an image to a private registry and not the central Docker\nregistry
|
|
||||||
you must tag it with the registry hostname and port (if needed).\n\n docker image
|
|
||||||
tag 0e5574283393 myregistryhost:5000/fedora/httpd:version1.0\n"
|
|
||||||
usage: docker image tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
|
usage: docker image tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
|
||||||
pname: docker image
|
pname: docker image
|
||||||
plink: docker_image.yaml
|
plink: docker_image.yaml
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,21 @@
|
||||||
command: docker images
|
command: docker images
|
||||||
short: List images
|
short: List images
|
||||||
long: |
|
long: |-
|
||||||
Alias for `docker image ls`.
|
The default `docker images` will show all top level
|
||||||
|
images, their repository and tags, and their size.
|
||||||
|
|
||||||
|
Docker images have intermediate layers that increase reusability,
|
||||||
|
decrease disk usage, and speed up `docker build` by
|
||||||
|
allowing each step to be cached. These intermediate layers are not shown
|
||||||
|
by default.
|
||||||
|
|
||||||
|
The `SIZE` is the cumulative space taken up by the image and all
|
||||||
|
its parent images. This is also the disk space used by the contents of the
|
||||||
|
Tar file created when you `docker save` an image.
|
||||||
|
|
||||||
|
An image will be listed more than once if it has multiple repository names
|
||||||
|
or tags. This single image (identifiable by its matching `IMAGE ID`)
|
||||||
|
uses up the `SIZE` listed only once.
|
||||||
usage: docker images [OPTIONS] [REPOSITORY[:TAG]]
|
usage: docker images [OPTIONS] [REPOSITORY[:TAG]]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -25,3 +39,293 @@ options:
|
||||||
shorthand: q
|
shorthand: q
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Only show numeric IDs
|
description: Only show numeric IDs
|
||||||
|
example: |-
|
||||||
|
### List the most recently created images
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
<none> <none> 77af4d6b9913 19 hours ago 1.089 GB
|
||||||
|
committ latest b6fa739cedf5 19 hours ago 1.089 GB
|
||||||
|
<none> <none> 78a85c484f71 19 hours ago 1.089 GB
|
||||||
|
docker latest 30557a29d5ab 20 hours ago 1.089 GB
|
||||||
|
<none> <none> 5ed6274db6ce 24 hours ago 1.089 GB
|
||||||
|
postgres 9 746b819f315e 4 days ago 213.4 MB
|
||||||
|
postgres 9.3 746b819f315e 4 days ago 213.4 MB
|
||||||
|
postgres 9.3.5 746b819f315e 4 days ago 213.4 MB
|
||||||
|
postgres latest 746b819f315e 4 days ago 213.4 MB
|
||||||
|
```
|
||||||
|
|
||||||
|
### List images by name and tag
|
||||||
|
|
||||||
|
The `docker images` command takes an optional `[REPOSITORY[:TAG]]` argument
|
||||||
|
that restricts the list to images that match the argument. If you specify
|
||||||
|
`REPOSITORY`but no `TAG`, the `docker images` command lists all images in the
|
||||||
|
given repository.
|
||||||
|
|
||||||
|
For example, to list all images in the "java" repository, run this command :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images java
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
java 8 308e519aac60 6 days ago 824.5 MB
|
||||||
|
java 7 493d82594c15 3 months ago 656.3 MB
|
||||||
|
java latest 2711b1d6f3aa 5 months ago 603.9 MB
|
||||||
|
```
|
||||||
|
|
||||||
|
The `[REPOSITORY[:TAG]]` value must be an "exact match". This means that, for example,
|
||||||
|
`docker images jav` does not match the image `java`.
|
||||||
|
|
||||||
|
If both `REPOSITORY` and `TAG` are provided, only images matching that
|
||||||
|
repository and tag are listed. To find all local images in the "java"
|
||||||
|
repository with tag "8" you can use:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images java:8
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
java 8 308e519aac60 6 days ago 824.5 MB
|
||||||
|
```
|
||||||
|
|
||||||
|
If nothing matches `REPOSITORY[:TAG]`, the list is empty.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images java:0
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
```
|
||||||
|
|
||||||
|
### List the full length image IDs
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images --no-trunc
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
<none> <none> sha256:77af4d6b9913e693e8d0b4b294fa62ade6054e6b2f1ffb617ac955dd63fb0182 19 hours ago 1.089 GB
|
||||||
|
committest latest sha256:b6fa739cedf5ea12a620a439402b6004d057da800f91c7524b5086a5e4749c9f 19 hours ago 1.089 GB
|
||||||
|
<none> <none> sha256:78a85c484f71509adeaace20e72e941f6bdd2b25b4c75da8693efd9f61a37921 19 hours ago 1.089 GB
|
||||||
|
docker latest sha256:30557a29d5abc51e5f1d5b472e79b7e296f595abcf19fe6b9199dbbc809c6ff4 20 hours ago 1.089 GB
|
||||||
|
<none> <none> sha256:0124422dd9f9cf7ef15c0617cda3931ee68346455441d66ab8bdc5b05e9fdce5 20 hours ago 1.089 GB
|
||||||
|
<none> <none> sha256:18ad6fad340262ac2a636efd98a6d1f0ea775ae3d45240d3418466495a19a81b 22 hours ago 1.082 GB
|
||||||
|
<none> <none> sha256:f9f1e26352f0a3ba6a0ff68167559f64f3e21ff7ada60366e2d44a04befd1d3a 23 hours ago 1.089 GB
|
||||||
|
tryout latest sha256:2629d1fa0b81b222fca63371ca16cbf6a0772d07759ff80e8d1369b926940074 23 hours ago 131.5 MB
|
||||||
|
<none> <none> sha256:5ed6274db6ceb2397844896966ea239290555e74ef307030ebb01ff91b1914df 24 hours ago 1.089 GB
|
||||||
|
```
|
||||||
|
|
||||||
|
### List image digests
|
||||||
|
|
||||||
|
Images that use the v2 or later format have a content-addressable identifier
|
||||||
|
called a `digest`. As long as the input used to generate the image is
|
||||||
|
unchanged, the digest value is predictable. To list image digest values, use
|
||||||
|
the `--digests` flag:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images --digests
|
||||||
|
REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE
|
||||||
|
localhost:5000/test/busybox <none> sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf 4986bf8c1536 9 weeks ago 2.43 MB
|
||||||
|
```
|
||||||
|
|
||||||
|
When pushing or pulling to a 2.0 registry, the `push` or `pull` command
|
||||||
|
output includes the image digest. You can `pull` using a digest value. You can
|
||||||
|
also reference by digest in `create`, `run`, and `rmi` commands, as well as the
|
||||||
|
`FROM` image reference in a Dockerfile.
|
||||||
|
|
||||||
|
### Filtering
|
||||||
|
|
||||||
|
The filtering flag (`-f` or `--filter`) format is of "key=value". If there is more
|
||||||
|
than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`)
|
||||||
|
|
||||||
|
The currently supported filters are:
|
||||||
|
|
||||||
|
* dangling (boolean - true or false)
|
||||||
|
* label (`label=<key>` or `label=<key>=<value>`)
|
||||||
|
* before (`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`) - filter images created before given id or references
|
||||||
|
* since (`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`) - filter images created since given id or references
|
||||||
|
|
||||||
|
#### Show untagged images (dangling)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images --filter "dangling=true"
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
<none> <none> 8abc22fbb042 4 weeks ago 0 B
|
||||||
|
<none> <none> 48e5f45168b9 4 weeks ago 2.489 MB
|
||||||
|
<none> <none> bf747efa0e2f 4 weeks ago 0 B
|
||||||
|
<none> <none> 980fe10e5736 12 weeks ago 101.4 MB
|
||||||
|
<none> <none> dea752e4e117 12 weeks ago 101.4 MB
|
||||||
|
<none> <none> 511136ea3c5a 8 months ago 0 B
|
||||||
|
```
|
||||||
|
|
||||||
|
This will display untagged images that are the leaves of the images tree (not
|
||||||
|
intermediary layers). These images occur when a new build of an image takes the
|
||||||
|
`repo:tag` away from the image ID, leaving it as `<none>:<none>` or untagged.
|
||||||
|
A warning will be issued if trying to remove an image when a container is presently
|
||||||
|
using it. By having this flag it allows for batch cleanup.
|
||||||
|
|
||||||
|
You can use this in conjunction with `docker rmi ...`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker rmi $(docker images -f "dangling=true" -q)
|
||||||
|
|
||||||
|
8abc22fbb042
|
||||||
|
48e5f45168b9
|
||||||
|
bf747efa0e2f
|
||||||
|
980fe10e5736
|
||||||
|
dea752e4e117
|
||||||
|
511136ea3c5a
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Note**: Docker warns you if any containers exist that are using these
|
||||||
|
> untagged images.
|
||||||
|
|
||||||
|
|
||||||
|
#### Show images with a given label
|
||||||
|
|
||||||
|
The `label` filter matches images based on the presence of a `label` alone or a `label` and a
|
||||||
|
value.
|
||||||
|
|
||||||
|
The following filter matches images with the `com.example.version` label regardless of its value.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images --filter "label=com.example.version"
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
match-me-1 latest eeae25ada2aa About a minute ago 188.3 MB
|
||||||
|
match-me-2 latest dea752e4e117 About a minute ago 188.3 MB
|
||||||
|
```
|
||||||
|
|
||||||
|
The following filter matches images with the `com.example.version` label with the `1.0` value.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images --filter "label=com.example.version=1.0"
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
match-me latest 511136ea3c5a About a minute ago 188.3 MB
|
||||||
|
```
|
||||||
|
|
||||||
|
In this example, with the `0.1` value, it returns an empty set because no matches were found.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images --filter "label=com.example.version=0.1"
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Filter images by time
|
||||||
|
|
||||||
|
The `before` filter shows only images created before the image with
|
||||||
|
given id or reference. For example, having these images:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
image1 latest eeae25ada2aa 4 minutes ago 188.3 MB
|
||||||
|
image2 latest dea752e4e117 9 minutes ago 188.3 MB
|
||||||
|
image3 latest 511136ea3c5a 25 minutes ago 188.3 MB
|
||||||
|
```
|
||||||
|
|
||||||
|
Filtering with `before` would give:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images --filter "before=image1"
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
image2 latest dea752e4e117 9 minutes ago 188.3 MB
|
||||||
|
image3 latest 511136ea3c5a 25 minutes ago 188.3 MB
|
||||||
|
```
|
||||||
|
|
||||||
|
Filtering with `since` would give:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images --filter "since=image3"
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
image1 latest eeae25ada2aa 4 minutes ago 188.3 MB
|
||||||
|
image2 latest dea752e4e117 9 minutes ago 188.3 MB
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Filter images by reference
|
||||||
|
|
||||||
|
The `reference` filter shows only images whose reference matches
|
||||||
|
the specified pattern.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
busybox latest e02e811dd08f 5 weeks ago 1.09 MB
|
||||||
|
busybox uclibc e02e811dd08f 5 weeks ago 1.09 MB
|
||||||
|
busybox musl 733eb3059dce 5 weeks ago 1.21 MB
|
||||||
|
busybox glibc 21c16b6787c6 5 weeks ago 4.19 MB
|
||||||
|
```
|
||||||
|
|
||||||
|
Filtering with `reference` would give:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images --filter=reference='busy*:*libc'
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
busybox uclibc e02e811dd08f 5 weeks ago 1.09 MB
|
||||||
|
busybox glibc 21c16b6787c6 5 weeks ago 4.19 MB
|
||||||
|
```
|
||||||
|
|
||||||
|
### Format the output
|
||||||
|
|
||||||
|
The formatting option (`--format`) will pretty print container output
|
||||||
|
using a Go template.
|
||||||
|
|
||||||
|
Valid placeholders for the Go template are listed below:
|
||||||
|
|
||||||
|
| Placeholder | Description|
|
||||||
|
| ---- | ---- |
|
||||||
|
| `.ID` | Image ID |
|
||||||
|
| `.Repository` | Image repository |
|
||||||
|
| `.Tag` | Image tag |
|
||||||
|
| `.Digest` | Image digest |
|
||||||
|
| `.CreatedSince` | Elapsed time since the image was created |
|
||||||
|
| `.CreatedAt` | Time when the image was created |
|
||||||
|
| `.Size` | Image disk size |
|
||||||
|
|
||||||
|
When using the `--format` option, the `image` command will either
|
||||||
|
output the data exactly as the template declares or, when using the
|
||||||
|
`table` directive, will include column headers as well.
|
||||||
|
|
||||||
|
The following example uses a template without headers and outputs the
|
||||||
|
`ID` and `Repository` entries separated by a colon for all images:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{% raw %}
|
||||||
|
$ docker images --format "{{.ID}}: {{.Repository}}"
|
||||||
|
|
||||||
|
77af4d6b9913: <none>
|
||||||
|
b6fa739cedf5: committ
|
||||||
|
78a85c484f71: <none>
|
||||||
|
30557a29d5ab: docker
|
||||||
|
5ed6274db6ce: <none>
|
||||||
|
746b819f315e: postgres
|
||||||
|
746b819f315e: postgres
|
||||||
|
746b819f315e: postgres
|
||||||
|
746b819f315e: postgres
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
To list all images with their repository and tag in a table format you
|
||||||
|
can use:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{% raw %}
|
||||||
|
$ docker images --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}"
|
||||||
|
|
||||||
|
IMAGE ID REPOSITORY TAG
|
||||||
|
77af4d6b9913 <none> <none>
|
||||||
|
b6fa739cedf5 committ latest
|
||||||
|
78a85c484f71 <none> <none>
|
||||||
|
30557a29d5ab docker latest
|
||||||
|
5ed6274db6ce <none> <none>
|
||||||
|
746b819f315e postgres 9
|
||||||
|
746b819f315e postgres 9.3
|
||||||
|
746b819f315e postgres 9.3.5
|
||||||
|
746b819f315e postgres latest
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
command: docker import
|
command: docker import
|
||||||
short: Import the contents from a tarball to create a filesystem image
|
short: Import the contents from a tarball to create a filesystem image
|
||||||
long: |
|
long: |-
|
||||||
Alias for `docker image import`.
|
You can specify a `URL` or `-` (dash) to take data directly from `STDIN`. The
|
||||||
|
`URL` can point to an archive (.tar, .tar.gz, .tgz, .bzip, .tar.xz, or .txz)
|
||||||
|
containing a filesystem or to an individual file on the Docker host. If you
|
||||||
|
specify an archive, Docker untars it in the container relative to the `/`
|
||||||
|
(root). If you specify an individual file, you must specify the full path within
|
||||||
|
the host. To import from a remote location, specify a `URI` that begins with the
|
||||||
|
`http://` or `https://` protocol.
|
||||||
|
|
||||||
|
The `--change` option will apply `Dockerfile` instructions to the image
|
||||||
|
that is created.
|
||||||
|
Supported `Dockerfile` instructions:
|
||||||
|
`CMD`|`ENTRYPOINT`|`ENV`|`EXPOSE`|`ONBUILD`|`USER`|`VOLUME`|`WORKDIR`
|
||||||
usage: docker import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]
|
usage: docker import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -13,3 +24,49 @@ options:
|
||||||
- option: message
|
- option: message
|
||||||
shorthand: m
|
shorthand: m
|
||||||
description: Set commit message for imported image
|
description: Set commit message for imported image
|
||||||
|
example: |-
|
||||||
|
### Import from a remote location
|
||||||
|
|
||||||
|
This will create a new untagged image.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker import http://example.com/exampleimage.tgz
|
||||||
|
```
|
||||||
|
|
||||||
|
### Import from a local file
|
||||||
|
|
||||||
|
- Import to docker via pipe and `STDIN`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cat exampleimage.tgz | docker import - exampleimagelocal:new
|
||||||
|
```
|
||||||
|
|
||||||
|
- Import with a commit message.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cat exampleimage.tgz | docker import --message "New image imported from tarball" - exampleimagelocal:new
|
||||||
|
```
|
||||||
|
|
||||||
|
- Import to docker from a local archive.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker import /path/to/exampleimage.tgz
|
||||||
|
```
|
||||||
|
|
||||||
|
### Import from a local directory
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo tar -c . | docker import - exampleimagedir
|
||||||
|
```
|
||||||
|
|
||||||
|
### Import from a local directory with new configurations
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo tar -c . | docker import --change "ENV DEBUG true" - exampleimagedir
|
||||||
|
```
|
||||||
|
|
||||||
|
Note the `sudo` in this example – you must preserve
|
||||||
|
the ownership of the files (especially root ownership) during the
|
||||||
|
archiving with tar. If you are not root (or the sudo command) when you
|
||||||
|
tar, then the ownerships might not get preserved.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,23 @@
|
||||||
command: docker info
|
command: docker info
|
||||||
short: Display system-wide information
|
short: Display system-wide information
|
||||||
long: |
|
long: |-
|
||||||
Alias for `docker system info`.
|
This command displays system wide information regarding the Docker installation.
|
||||||
|
Information displayed includes the kernel version, number of containers and images.
|
||||||
|
The number of images shown is the number of unique images. The same image tagged
|
||||||
|
under different names is counted only once.
|
||||||
|
|
||||||
|
If a format is specified, the given template will be executed instead of the
|
||||||
|
default format. Go's [text/template](http://golang.org/pkg/text/template/) package
|
||||||
|
describes all the details of the format.
|
||||||
|
|
||||||
|
Depending on the storage driver in use, additional information can be shown, such
|
||||||
|
as pool name, data file, metadata file, data space used, total data space, metadata
|
||||||
|
space used, and total metadata space.
|
||||||
|
|
||||||
|
The data file is where the images are stored and the metadata file is where the
|
||||||
|
meta data regarding those images are stored. When run for the first time Docker
|
||||||
|
allocates a certain amount of data space and meta data space from the space
|
||||||
|
available on the volume where `/var/lib/docker` is mounted.
|
||||||
usage: docker info [OPTIONS]
|
usage: docker info [OPTIONS]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -9,3 +25,201 @@ options:
|
||||||
- option: format
|
- option: format
|
||||||
shorthand: f
|
shorthand: f
|
||||||
description: Format the output using the given Go template
|
description: Format the output using the given Go template
|
||||||
|
example: |-
|
||||||
|
### Show output
|
||||||
|
|
||||||
|
The example below shows the output for a daemon running on Red Hat Enterprise Linux,
|
||||||
|
using the `devicemapper` storage driver. As can be seen in the output, additional
|
||||||
|
information about the `devicemapper` storage driver is shown:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker info
|
||||||
|
|
||||||
|
Containers: 14
|
||||||
|
Running: 3
|
||||||
|
Paused: 1
|
||||||
|
Stopped: 10
|
||||||
|
Images: 52
|
||||||
|
Server Version: 1.10.3
|
||||||
|
Storage Driver: devicemapper
|
||||||
|
Pool Name: docker-202:2-25583803-pool
|
||||||
|
Pool Blocksize: 65.54 kB
|
||||||
|
Base Device Size: 10.74 GB
|
||||||
|
Backing Filesystem: xfs
|
||||||
|
Data file: /dev/loop0
|
||||||
|
Metadata file: /dev/loop1
|
||||||
|
Data Space Used: 1.68 GB
|
||||||
|
Data Space Total: 107.4 GB
|
||||||
|
Data Space Available: 7.548 GB
|
||||||
|
Metadata Space Used: 2.322 MB
|
||||||
|
Metadata Space Total: 2.147 GB
|
||||||
|
Metadata Space Available: 2.145 GB
|
||||||
|
Udev Sync Supported: true
|
||||||
|
Deferred Removal Enabled: false
|
||||||
|
Deferred Deletion Enabled: false
|
||||||
|
Deferred Deleted Device Count: 0
|
||||||
|
Data loop file: /var/lib/docker/devicemapper/devicemapper/data
|
||||||
|
Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
|
||||||
|
Library Version: 1.02.107-RHEL7 (2015-12-01)
|
||||||
|
Execution Driver: native-0.2
|
||||||
|
Logging Driver: json-file
|
||||||
|
Plugins:
|
||||||
|
Volume: local
|
||||||
|
Network: null host bridge
|
||||||
|
Kernel Version: 3.10.0-327.el7.x86_64
|
||||||
|
Operating System: Red Hat Enterprise Linux Server 7.2 (Maipo)
|
||||||
|
OSType: linux
|
||||||
|
Architecture: x86_64
|
||||||
|
CPUs: 1
|
||||||
|
Total Memory: 991.7 MiB
|
||||||
|
Name: ip-172-30-0-91.ec2.internal
|
||||||
|
ID: I54V:OLXT:HVMM:TPKO:JPHQ:CQCD:JNLC:O3BZ:4ZVJ:43XJ:PFHZ:6N2S
|
||||||
|
Docker Root Dir: /var/lib/docker
|
||||||
|
Debug mode (client): false
|
||||||
|
Debug mode (server): false
|
||||||
|
Username: gordontheturtle
|
||||||
|
Registry: https://index.docker.io/v1/
|
||||||
|
Insecure registries:
|
||||||
|
myinsecurehost:5000
|
||||||
|
127.0.0.0/8
|
||||||
|
```
|
||||||
|
|
||||||
|
### Show debugging output
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker -D info
|
||||||
|
|
||||||
|
Containers: 14
|
||||||
|
Running: 3
|
||||||
|
Paused: 1
|
||||||
|
Stopped: 10
|
||||||
|
Images: 52
|
||||||
|
Server Version: 1.13.0
|
||||||
|
Storage Driver: overlay2
|
||||||
|
Backing Filesystem: extfs
|
||||||
|
Supports d_type: true
|
||||||
|
Native Overlay Diff: false
|
||||||
|
Logging Driver: json-file
|
||||||
|
Cgroup Driver: cgroupfs
|
||||||
|
Plugins:
|
||||||
|
Volume: local
|
||||||
|
Network: bridge host macvlan null overlay
|
||||||
|
Swarm: active
|
||||||
|
NodeID: rdjq45w1op418waxlairloqbm
|
||||||
|
Is Manager: true
|
||||||
|
ClusterID: te8kdyw33n36fqiz74bfjeixd
|
||||||
|
Managers: 1
|
||||||
|
Nodes: 2
|
||||||
|
Orchestration:
|
||||||
|
Task History Retention Limit: 5
|
||||||
|
Raft:
|
||||||
|
Snapshot Interval: 10000
|
||||||
|
Number of Old Snapshots to Retain: 0
|
||||||
|
Heartbeat Tick: 1
|
||||||
|
Election Tick: 3
|
||||||
|
Dispatcher:
|
||||||
|
Heartbeat Period: 5 seconds
|
||||||
|
CA Configuration:
|
||||||
|
Expiry Duration: 3 months
|
||||||
|
Node Address: 172.16.66.128 172.16.66.129
|
||||||
|
Manager Addresses:
|
||||||
|
172.16.66.128:2477
|
||||||
|
Runtimes: runc
|
||||||
|
Default Runtime: runc
|
||||||
|
Init Binary: docker-init
|
||||||
|
containerd version: 8517738ba4b82aff5662c97ca4627e7e4d03b531
|
||||||
|
runc version: ac031b5bf1cc92239461125f4c1ffb760522bbf2
|
||||||
|
init version: N/A (expected: v0.13.0)
|
||||||
|
Security Options:
|
||||||
|
apparmor
|
||||||
|
seccomp
|
||||||
|
Profile: default
|
||||||
|
Kernel Version: 4.4.0-31-generic
|
||||||
|
Operating System: Ubuntu 16.04.1 LTS
|
||||||
|
OSType: linux
|
||||||
|
Architecture: x86_64
|
||||||
|
CPUs: 2
|
||||||
|
Total Memory: 1.937 GiB
|
||||||
|
Name: ubuntu
|
||||||
|
ID: H52R:7ZR6:EIIA:76JG:ORIY:BVKF:GSFU:HNPG:B5MK:APSC:SZ3Q:N326
|
||||||
|
Docker Root Dir: /var/lib/docker
|
||||||
|
Debug Mode (client): true
|
||||||
|
Debug Mode (server): true
|
||||||
|
File Descriptors: 30
|
||||||
|
Goroutines: 123
|
||||||
|
System Time: 2016-11-12T17:24:37.955404361-08:00
|
||||||
|
EventsListeners: 0
|
||||||
|
Http Proxy: http://test:test@proxy.example.com:8080
|
||||||
|
Https Proxy: https://test:test@proxy.example.com:8080
|
||||||
|
No Proxy: localhost,127.0.0.1,docker-registry.somecorporation.com
|
||||||
|
Registry: https://index.docker.io/v1/
|
||||||
|
WARNING: No swap limit support
|
||||||
|
Labels:
|
||||||
|
storage=ssd
|
||||||
|
staging=true
|
||||||
|
Experimental: false
|
||||||
|
Insecure Registries:
|
||||||
|
127.0.0.0/8
|
||||||
|
Registry Mirrors:
|
||||||
|
http://192.168.1.2/
|
||||||
|
http://registry-mirror.example.com:5000/
|
||||||
|
Live Restore Enabled: false
|
||||||
|
```
|
||||||
|
|
||||||
|
The global `-D` option causes all `docker` commands to output debug information.
|
||||||
|
|
||||||
|
### Format the output
|
||||||
|
|
||||||
|
You can also specify the output format:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{% raw %}
|
||||||
|
$ docker info --format '{{json .}}'
|
||||||
|
|
||||||
|
{"ID":"I54V:OLXT:HVMM:TPKO:JPHQ:CQCD:JNLC:O3BZ:4ZVJ:43XJ:PFHZ:6N2S","Containers":14, ...}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run `docker info` on Windows
|
||||||
|
|
||||||
|
Here is a sample output for a daemon running on Windows Server 2016:
|
||||||
|
|
||||||
|
```none
|
||||||
|
E:\docker>docker info
|
||||||
|
|
||||||
|
Containers: 1
|
||||||
|
Running: 0
|
||||||
|
Paused: 0
|
||||||
|
Stopped: 1
|
||||||
|
Images: 17
|
||||||
|
Server Version: 1.13.0
|
||||||
|
Storage Driver: windowsfilter
|
||||||
|
Windows:
|
||||||
|
Logging Driver: json-file
|
||||||
|
Plugins:
|
||||||
|
Volume: local
|
||||||
|
Network: nat null overlay
|
||||||
|
Swarm: inactive
|
||||||
|
Default Isolation: process
|
||||||
|
Kernel Version: 10.0 14393 (14393.206.amd64fre.rs1_release.160912-1937)
|
||||||
|
Operating System: Windows Server 2016 Datacenter
|
||||||
|
OSType: windows
|
||||||
|
Architecture: x86_64
|
||||||
|
CPUs: 8
|
||||||
|
Total Memory: 3.999 GiB
|
||||||
|
Name: WIN-V0V70C0LU5P
|
||||||
|
ID: NYMS:B5VK:UMSL:FVDZ:EWB5:FKVK:LPFL:FJMQ:H6FT:BZJ6:L2TD:XH62
|
||||||
|
Docker Root Dir: C:\control
|
||||||
|
Debug Mode (client): false
|
||||||
|
Debug Mode (server): false
|
||||||
|
Registry: https://index.docker.io/v1/
|
||||||
|
Insecure Registries:
|
||||||
|
127.0.0.0/8
|
||||||
|
Registry Mirrors:
|
||||||
|
http://192.168.1.2/
|
||||||
|
http://registry-mirror.example.com:5000/
|
||||||
|
Live Restore Enabled: false
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,109 +1,12 @@
|
||||||
command: docker inspect
|
command: docker inspect
|
||||||
short: Return low-level information on Docker objects
|
short: Return low-level information on Docker objects
|
||||||
long: "This displays the low-level information on Docker object(s) (e.g. container,
|
long: |-
|
||||||
\nimage, volume,network, node, service, or task) identified by name or ID. By default,\nthis
|
By default, `docker inspect` will render all results in a JSON array. If the container and
|
||||||
will render all results in a JSON array. If the container and image have\nthe same
|
image have the same name, this will return container JSON for unspecified type.
|
||||||
name, this will return container JSON for unspecified type. If a format\nis specified,
|
If a format is specified, the given template will be executed for each result.
|
||||||
the given template will be executed for each result.\n\n# EXAMPLES\n\nGet information
|
|
||||||
about an image when image name conflicts with the container name,\ne.g. both image
|
Go's [text/template](http://golang.org/pkg/text/template/) package
|
||||||
and container are named rhel7:\n\n $ docker inspect --type=image rhel7\n [\n
|
describes all the details of the format.
|
||||||
\ {\n \"Id\": \"fe01a428b9d9de35d29531e9994157978e8c48fa693e1bf1d221dffbbb67b170\",\n
|
|
||||||
\ \"Parent\": \"10acc31def5d6f249b548e01e8ffbaccfd61af0240c17315a7ad393d022c5ca2\",\n
|
|
||||||
\ ....\n }\n ]\n\n## Getting information on a container\n\nTo get information
|
|
||||||
on a container use its ID or instance name:\n\n $ docker inspect d2cc496561d6\n
|
|
||||||
\ [{\n \"Id\": \"d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47\",\n
|
|
||||||
\ \"Created\": \"2015-06-08T16:18:02.505155285Z\",\n \"Path\": \"bash\",\n
|
|
||||||
\ \"Args\": [],\n \"State\": {\n \"Running\": false,\n \"Paused\":
|
|
||||||
false,\n \"Restarting\": false,\n \"OOMKilled\": false,\n \"Dead\":
|
|
||||||
false,\n \"Pid\": 0,\n \"ExitCode\": 0,\n \"Error\": \"\",\n
|
|
||||||
\ \"StartedAt\": \"2015-06-08T16:18:03.643865954Z\",\n \"FinishedAt\":
|
|
||||||
\"2015-06-08T16:57:06.448552862Z\"\n },\n \"Image\": \"ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4\",\n
|
|
||||||
\ \"NetworkSettings\": {\n \"Bridge\": \"\",\n \"SandboxID\": \"6b4851d1903e16dd6a567bd526553a86664361f31036eaaa2f8454d6f4611f6f\",\n
|
|
||||||
\ \"HairpinMode\": false,\n \"LinkLocalIPv6Address\": \"\",\n \"LinkLocalIPv6PrefixLen\":
|
|
||||||
0,\n \"Ports\": {},\n \"SandboxKey\": \"/var/run/docker/netns/6b4851d1903e\",\n
|
|
||||||
\ \"SecondaryIPAddresses\": null,\n \"SecondaryIPv6Addresses\": null,\n
|
|
||||||
\ \"EndpointID\": \"7587b82f0dada3656fda26588aee72630c6fab1536d36e394b2bfbcf898c971d\",\n
|
|
||||||
\ \"Gateway\": \"172.17.0.1\",\n \"GlobalIPv6Address\": \"\",\n \"GlobalIPv6PrefixLen\":
|
|
||||||
0,\n \"IPAddress\": \"172.17.0.2\",\n \"IPPrefixLen\": 16,\n \"IPv6Gateway\":
|
|
||||||
\"\",\n \"MacAddress\": \"02:42:ac:12:00:02\",\n \"Networks\": {\n
|
|
||||||
\ \"bridge\": {\n \"NetworkID\": \"7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812\",\n
|
|
||||||
\ \"EndpointID\": \"7587b82f0dada3656fda26588aee72630c6fab1536d36e394b2bfbcf898c971d\",\n
|
|
||||||
\ \"Gateway\": \"172.17.0.1\",\n \"IPAddress\": \"172.17.0.2\",\n
|
|
||||||
\ \"IPPrefixLen\": 16,\n \"IPv6Gateway\": \"\",\n \"GlobalIPv6Address\":
|
|
||||||
\"\",\n \"GlobalIPv6PrefixLen\": 0,\n \"MacAddress\":
|
|
||||||
\"02:42:ac:12:00:02\"\n }\n }\n\n },\n \"ResolvConfPath\":
|
|
||||||
\"/var/lib/docker/containers/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47/resolv.conf\",\n
|
|
||||||
\ \"HostnamePath\": \"/var/lib/docker/containers/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47/hostname\",\n
|
|
||||||
\ \"HostsPath\": \"/var/lib/docker/containers/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47/hosts\",\n
|
|
||||||
\ \"LogPath\": \"/var/lib/docker/containers/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47-json.log\",\n
|
|
||||||
\ \"Name\": \"/adoring_wozniak\",\n \"RestartCount\": 0,\n \"Driver\": \"devicemapper\",\n
|
|
||||||
\ \"MountLabel\": \"\",\n \"ProcessLabel\": \"\",\n \"Mounts\": [\n {\n
|
|
||||||
\ \"Source\": \"/data\",\n \"Destination\": \"/data\",\n \"Mode\":
|
|
||||||
\"ro,Z\",\n \"RW\": false\n\t\"Propagation\": \"\"\n }\n ],\n \"AppArmorProfile\":
|
|
||||||
\"\",\n \"ExecIDs\": null,\n \"HostConfig\": {\n \"Binds\": null,\n
|
|
||||||
\ \"ContainerIDFile\": \"\",\n \"Memory\": 0,\n \"MemorySwap\":
|
|
||||||
0,\n \"CpuShares\": 0,\n \"CpuPeriod\": 0,\n \"CpusetCpus\":
|
|
||||||
\"\",\n \"CpusetMems\": \"\",\n \"CpuQuota\": 0,\n \"BlkioWeight\":
|
|
||||||
0,\n \"OomKillDisable\": false,\n \"Privileged\": false,\n \"PortBindings\":
|
|
||||||
{},\n \"Links\": null,\n \"PublishAllPorts\": false,\n \"Dns\":
|
|
||||||
null,\n \"DnsSearch\": null,\n \"DnsOptions\": null,\n \"ExtraHosts\":
|
|
||||||
null,\n \"VolumesFrom\": null,\n \"Devices\": [],\n \"NetworkMode\":
|
|
||||||
\"bridge\",\n \"IpcMode\": \"\",\n \"PidMode\": \"\",\n \"UTSMode\":
|
|
||||||
\"\",\n \"CapAdd\": null,\n \"CapDrop\": null,\n \"RestartPolicy\":
|
|
||||||
{\n \"Name\": \"no\",\n \"MaximumRetryCount\": 0\n },\n
|
|
||||||
\ \"SecurityOpt\": null,\n \"ReadonlyRootfs\": false,\n \"Ulimits\":
|
|
||||||
null,\n \"LogConfig\": {\n \"Type\": \"json-file\",\n \"Config\":
|
|
||||||
{}\n },\n \"CgroupParent\": \"\"\n },\n \"GraphDriver\": {\n
|
|
||||||
\ \"Name\": \"devicemapper\",\n \"Data\": {\n \"DeviceId\":
|
|
||||||
\"5\",\n \"DeviceName\": \"docker-253:1-2763198-d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47\",\n
|
|
||||||
\ \"DeviceSize\": \"171798691840\"\n }\n },\n \"Config\":
|
|
||||||
{\n \"Hostname\": \"d2cc496561d6\",\n \"Domainname\": \"\",\n \"User\":
|
|
||||||
\"\",\n \"AttachStdin\": true,\n \"AttachStdout\": true,\n \"AttachStderr\":
|
|
||||||
true,\n \"ExposedPorts\": null,\n \"Tty\": true,\n \"OpenStdin\":
|
|
||||||
true,\n \"StdinOnce\": true,\n \"Env\": null,\n \"Cmd\": [\n
|
|
||||||
\ \"bash\"\n ],\n \"Image\": \"fedora\",\n \"Volumes\":
|
|
||||||
null,\n \"VolumeDriver\": \"\",\n \"WorkingDir\": \"\",\n \"Entrypoint\":
|
|
||||||
null,\n \"NetworkDisabled\": false,\n \"MacAddress\": \"\",\n \"OnBuild\":
|
|
||||||
null,\n \"Labels\": {},\n \"Memory\": 0,\n \"MemorySwap\":
|
|
||||||
0,\n \"CpuShares\": 0,\n \"Cpuset\": \"\",\n \"StopSignal\":
|
|
||||||
\"SIGTERM\"\n }\n }\n ]\n## Getting the IP address of a container instance\n\nTo
|
|
||||||
get the IP address of a container use:\n\n $ docker inspect --format='{{range
|
|
||||||
.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' d2cc496561d6\n 172.17.0.2\n\n##
|
|
||||||
Listing all port bindings\n\nOne can loop over arrays and maps in the results to
|
|
||||||
produce simple text\noutput:\n\n $ docker inspect --format='{{range $p, $conf
|
|
||||||
:= .NetworkSettings.Ports}} \\\n {{$p}} -> {{(index $conf 0).HostPort}} {{end}}'
|
|
||||||
d2cc496561d6\n 80/tcp -> 80\n\nYou can get more information about how to write
|
|
||||||
a Go template from:\nhttps://golang.org/pkg/text/template/.\n\n## Getting size information
|
|
||||||
on a container\n\n $ docker inspect -s d2cc496561d6\n [\n {\n ....\n
|
|
||||||
\ \"SizeRw\": 0,\n \"SizeRootFs\": 972,\n ....\n }\n ]\n\n## Getting
|
|
||||||
information on an image\n\nUse an image's ID or name (e.g., repository/name[:tag])
|
|
||||||
to get information\nabout the image:\n\n $ docker inspect ded7cd95e059\n [{\n
|
|
||||||
\ \"Id\": \"ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4\",\n
|
|
||||||
\ \"Parent\": \"48ecf305d2cf7046c1f5f8fcbcd4994403173441d4a7f125b1bb0ceead9de731\",\n
|
|
||||||
\ \"Comment\": \"\",\n \"Created\": \"2015-05-27T16:58:22.937503085Z\",\n \"Container\":
|
|
||||||
\"76cf7f67d83a7a047454b33007d03e32a8f474ad332c3a03c94537edd22b312b\",\n \"ContainerConfig\":
|
|
||||||
{\n \"Hostname\": \"76cf7f67d83a\",\n \"Domainname\": \"\",\n \"User\":
|
|
||||||
\"\",\n \"AttachStdin\": false,\n \"AttachStdout\": false,\n \"AttachStderr\":
|
|
||||||
false,\n \"ExposedPorts\": null,\n \"Tty\": false,\n \"OpenStdin\":
|
|
||||||
false,\n \"StdinOnce\": false,\n \"Env\": null,\n \"Cmd\":
|
|
||||||
[\n \"/bin/sh\",\n \"-c\",\n \"#(nop) ADD file:4be46382bcf2b095fcb9fe8334206b584eff60bb3fad8178cbd97697fcb2ea83
|
|
||||||
in /\"\n ],\n \"Image\": \"48ecf305d2cf7046c1f5f8fcbcd4994403173441d4a7f125b1bb0ceead9de731\",\n
|
|
||||||
\ \"Volumes\": null,\n \"VolumeDriver\": \"\",\n \"WorkingDir\":
|
|
||||||
\"\",\n \"Entrypoint\": null,\n \"NetworkDisabled\": false,\n \"MacAddress\":
|
|
||||||
\"\",\n \"OnBuild\": null,\n \"Labels\": {}\n },\n \"DockerVersion\":
|
|
||||||
\"1.6.0\",\n \"Author\": \"Lokesh Mandvekar \\u003clsm5@fedoraproject.org\\u003e\",\n
|
|
||||||
\ \"Config\": {\n \"Hostname\": \"76cf7f67d83a\",\n \"Domainname\":
|
|
||||||
\"\",\n \"User\": \"\",\n \"AttachStdin\": false,\n \"AttachStdout\":
|
|
||||||
false,\n \"AttachStderr\": false,\n \"ExposedPorts\": null,\n \"Tty\":
|
|
||||||
false,\n \"OpenStdin\": false,\n \"StdinOnce\": false,\n \"Env\":
|
|
||||||
null,\n \"Cmd\": null,\n \"Image\": \"48ecf305d2cf7046c1f5f8fcbcd4994403173441d4a7f125b1bb0ceead9de731\",\n
|
|
||||||
\ \"Volumes\": null,\n \"VolumeDriver\": \"\",\n \"WorkingDir\":
|
|
||||||
\"\",\n \"Entrypoint\": null,\n \"NetworkDisabled\": false,\n \"MacAddress\":
|
|
||||||
\"\",\n \"OnBuild\": null,\n \"Labels\": {}\n },\n \"Architecture\":
|
|
||||||
\"amd64\",\n \"Os\": \"linux\",\n \"Size\": 186507296,\n \"VirtualSize\":
|
|
||||||
186507296,\n \"GraphDriver\": {\n \"Name\": \"devicemapper\",\n \"Data\":
|
|
||||||
{\n \"DeviceId\": \"3\",\n \"DeviceName\": \"docker-253:1-2763198-ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4\",\n
|
|
||||||
\ \"DeviceSize\": \"171798691840\"\n }\n }\n }\n ]\n"
|
|
||||||
usage: docker inspect [OPTIONS] NAME|ID [NAME|ID...]
|
usage: docker inspect [OPTIONS] NAME|ID [NAME|ID...]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -117,3 +20,79 @@ options:
|
||||||
description: Display total file sizes if the type is container
|
description: Display total file sizes if the type is container
|
||||||
- option: type
|
- option: type
|
||||||
description: Return JSON for specified type
|
description: Return JSON for specified type
|
||||||
|
example: |-
|
||||||
|
### Get an instance's IP address
|
||||||
|
|
||||||
|
For the most part, you can pick out any field from the JSON in a fairly
|
||||||
|
straightforward manner.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{% raw %}
|
||||||
|
$ docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $INSTANCE_ID
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Get an instance's MAC address
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{% raw %}
|
||||||
|
$ docker inspect --format='{{range .NetworkSettings.Networks}}{{.MacAddress}}{{end}}' $INSTANCE_ID
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Get an instance's log path
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{% raw %}
|
||||||
|
$ docker inspect --format='{{.LogPath}}' $INSTANCE_ID
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Get an instance's image name
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{% raw %}
|
||||||
|
$ docker inspect --format='{{.Container.Spec.Image}}' $INSTANCE_ID
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
### List all port bindings
|
||||||
|
|
||||||
|
You can loop over arrays and maps in the results to produce simple text
|
||||||
|
output:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{% raw %}
|
||||||
|
$ docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' $INSTANCE_ID
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Find a specific port mapping
|
||||||
|
|
||||||
|
The `.Field` syntax doesn't work when the field name begins with a
|
||||||
|
number, but the template language's `index` function does. The
|
||||||
|
`.NetworkSettings.Ports` section contains a map of the internal port
|
||||||
|
mappings to a list of external address/port objects. To grab just the
|
||||||
|
numeric public port, you use `index` to find the specific port map, and
|
||||||
|
then `index` 0 contains the first object inside of that. Then we ask for
|
||||||
|
the `HostPort` field to get the public address.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{% raw %}
|
||||||
|
$ docker inspect --format='{{(index (index .NetworkSettings.Ports "8787/tcp") 0).HostPort}}' $INSTANCE_ID
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Get a subsection in JSON format
|
||||||
|
|
||||||
|
If you request a field which is itself a structure containing other
|
||||||
|
fields, by default you get a Go-style dump of the inner values.
|
||||||
|
Docker adds a template function, `json`, which can be applied to get
|
||||||
|
results in JSON format.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{% raw %}
|
||||||
|
$ docker inspect --format='{{json .Config}}' $INSTANCE_ID
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
command: docker kill
|
command: docker kill
|
||||||
short: Kill one or more running containers
|
short: Kill one or more running containers
|
||||||
long: |
|
long: |-
|
||||||
Alias for `docker container kill`.
|
The main process inside the container will be sent `SIGKILL`, or any
|
||||||
|
signal specified with option `--signal`.
|
||||||
|
|
||||||
|
> **Note**: `ENTRYPOINT` and `CMD` in the *shell* form run as a subcommand of
|
||||||
|
> `/bin/sh -c`, which does not pass signals. This means that the executable is
|
||||||
|
> not the container’s PID 1 and does not receive Unix signals.
|
||||||
usage: docker kill [OPTIONS] CONTAINER [CONTAINER...]
|
usage: docker kill [OPTIONS] CONTAINER [CONTAINER...]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -10,3 +15,4 @@ options:
|
||||||
shorthand: s
|
shorthand: s
|
||||||
default_value: KILL
|
default_value: KILL
|
||||||
description: Signal to send to the container
|
description: Signal to send to the container
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
command: docker load
|
command: docker load
|
||||||
short: Load an image from a tar archive or STDIN
|
short: Load an image from a tar archive or STDIN
|
||||||
long: |
|
long: |-
|
||||||
Alias for `docker image load`.
|
`docker load` loads a tarred repository from a file or the standard input stream.
|
||||||
|
It restores both images and tags.
|
||||||
usage: docker load [OPTIONS]
|
usage: docker load [OPTIONS]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -13,3 +14,32 @@ options:
|
||||||
shorthand: q
|
shorthand: q
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Suppress the load output
|
description: Suppress the load output
|
||||||
|
example: |-
|
||||||
|
```bash
|
||||||
|
$ docker images
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
|
||||||
|
$ docker load < busybox.tar.gz
|
||||||
|
|
||||||
|
Loaded image: busybox:latest
|
||||||
|
$ docker images
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
busybox latest 769b9341d937 7 weeks ago 2.489 MB
|
||||||
|
|
||||||
|
$ docker load --input fedora.tar
|
||||||
|
|
||||||
|
Loaded image: fedora:rawhide
|
||||||
|
|
||||||
|
Loaded image: fedora:20
|
||||||
|
|
||||||
|
$ docker images
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
busybox latest 769b9341d937 7 weeks ago 2.489 MB
|
||||||
|
fedora rawhide 0d20aec6529d 7 weeks ago 387 MB
|
||||||
|
fedora 20 58394af37342 7 weeks ago 385.5 MB
|
||||||
|
fedora heisenbug 58394af37342 7 weeks ago 385.5 MB
|
||||||
|
fedora latest 58394af37342 7 weeks ago 385.5 MB
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,28 +1,60 @@
|
||||||
command: docker login
|
command: docker login
|
||||||
short: Log in to a Docker registry
|
short: Log in to a Docker registry
|
||||||
long: |
|
long: "Login to a registry.\n\n### Login to a self-hosted registry\n\nIf you want
|
||||||
Log in to a Docker Registry located on the specified
|
to login to a self-hosted registry you can specify this by\nadding the server name.\n\n```bash\n$
|
||||||
`SERVER`. You can specify a URL or a `hostname` for the `SERVER` value. If you
|
docker login localhost:8080\n```\n\n### Privileged user requirement\n\n`docker login`
|
||||||
do not specify a `SERVER`, the command uses Docker's public registry located at
|
requires user to use `sudo` or be `root`, except when:\n\n1. connecting to a remote
|
||||||
`https://registry-1.docker.io/` by default. To get a username/password for Docker's public registry, create an account on Docker Hub.
|
daemon, such as a `docker-machine` provisioned `docker engine`.\n2. user is added
|
||||||
|
to the `docker` group. This will impact the security of your system; the `docker`
|
||||||
`docker login` requires user to use `sudo` or be `root`, except when:
|
group is `root` equivalent. See [Docker Daemon Attack Surface](https://docs.docker.com/security/security/#docker-daemon-attack-surface)
|
||||||
|
for details.\n\nYou can log into any public or private repository for which you
|
||||||
1. connecting to a remote daemon, such as a `docker-machine` provisioned `docker engine`.
|
have\ncredentials. When you log in, the command stores encoded credentials in\n`$HOME/.docker/config.json`
|
||||||
2. user is added to the `docker` group. This will impact the security of your system; the `docker` group is `root` equivalent. See [Docker Daemon Attack Surface](https://docs.docker.com/engine/security/security/#/docker-daemon-attack-surface) for details.
|
on Linux or `%USERPROFILE%/.docker/config.json` on Windows.\n\n### Credentials store\n\nThe
|
||||||
|
Docker Engine can keep user credentials in an external credentials store,\nsuch
|
||||||
You can log into any public or private repository for which you have
|
as the native keychain of the operating system. Using an external store\nis more
|
||||||
credentials. When you log in, the command stores encoded credentials in
|
secure than storing credentials in the Docker configuration file.\n\nTo use a credentials
|
||||||
`$HOME/.docker/config.json` on Linux or `%!U(MISSING)SERPROFILE%!/(MISSING).docker/config.json` on Windows.
|
store, you need an external helper program to interact\nwith a specific keychain
|
||||||
|
or external store. Docker requires the helper\nprogram to be in the client's host
|
||||||
# EXAMPLES
|
`$PATH`.\n\nThis is the list of currently available credentials helpers and where\nyou
|
||||||
|
can download them from:\n\n- D-Bus Secret Service: https://github.com/docker/docker-credential-helpers/releases\n-
|
||||||
## Login to a registry on your localhost
|
Apple macOS keychain: https://github.com/docker/docker-credential-helpers/releases\n-
|
||||||
|
Microsoft Windows Credential Manager: https://github.com/docker/docker-credential-helpers/releases\n\nYou
|
||||||
# docker login localhost:8080
|
need to specify the credentials store in `$HOME/.docker/config.json`\nto tell the
|
||||||
|
docker engine to use it. The value of the config property should be\nthe suffix
|
||||||
# See also
|
of the program to use (i.e. everything after `docker-credential-`).\nFor example,
|
||||||
**docker-logout(1)** to log out from a Docker registry.
|
to use `docker-credential-osxkeychain`:\n\n```json\n{\n\t\"credsStore\": \"osxkeychain\"\n}\n```\n\nIf
|
||||||
|
you are currently logged in, run `docker logout` to remove\nthe credentials from
|
||||||
|
the file and run `docker login` again.\n\n### Credential helper protocol\n\nCredential
|
||||||
|
helpers can be any program or script that follows a very simple protocol.\nThis
|
||||||
|
protocol is heavily inspired by Git, but it differs in the information shared.\n\nThe
|
||||||
|
helpers always use the first argument in the command to identify the action.\nThere
|
||||||
|
are only three possible values for that argument: `store`, `get`, and `erase`.\n\nThe
|
||||||
|
`store` command takes a JSON payload from the standard input. That payload carries\nthe
|
||||||
|
server address, to identify the credential, the user name, and either a password\nor
|
||||||
|
an identity token.\n\n```json\n{\n\t\"ServerURL\": \"https://index.docker.io/v1\",\n\t\"Username\":
|
||||||
|
\"david\",\n\t\"Secret\": \"passw0rd1\"\n}\n```\n\nIf the secret being stored is
|
||||||
|
an identity token, the Username should be set to\n`<token>`.\n\nThe `store` command
|
||||||
|
can write error messages to `STDOUT` that the docker engine\nwill show if there
|
||||||
|
was an issue.\n\nThe `get` command takes a string payload from the standard input.
|
||||||
|
That payload carries\nthe server address that the docker engine needs credentials
|
||||||
|
for. This is\nan example of that payload: `https://index.docker.io/v1`.\n\nThe `get`
|
||||||
|
command writes a JSON payload to `STDOUT`. Docker reads the user name\nand password
|
||||||
|
from this payload:\n\n```json\n{\n\t\"Username\": \"david\",\n\t\"Secret\": \"passw0rd1\"\n}\n```\n\nThe
|
||||||
|
`erase` command takes a string payload from `STDIN`. That payload carries\nthe server
|
||||||
|
address that the docker engine wants to remove credentials for. This is\nan example
|
||||||
|
of that payload: `https://index.docker.io/v1`.\n\nThe `erase` command can write
|
||||||
|
error messages to `STDOUT` that the docker engine\nwill show if there was an issue.\n\n###
|
||||||
|
Credential helpers\n\nCredential helpers are similar to the credential store above,
|
||||||
|
but act as the\ndesignated programs to handle credentials for *specific registries*.
|
||||||
|
The default\ncredential store (`credsStore` or the config file itself) will not
|
||||||
|
be used for\noperations concerning credentials of the specified registries.\n\n###
|
||||||
|
Logging out\n\nIf you are currently logged in, run `docker logout` to remove\nthe
|
||||||
|
credentials from the default store.\n\nCredential helpers are specified in a similar
|
||||||
|
way to `credsStore`, but\nallow for multiple helpers to be configured at a time.
|
||||||
|
Keys specify the\nregistry domain, and values specify the suffix of the program
|
||||||
|
to use\n(i.e. everything after `docker-credential-`).\nFor example:\n\n```json\n{\n
|
||||||
|
\ \"credHelpers\": {\n \"registry.example.com\": \"registryhelper\",\n \"awesomereg.example.org\":
|
||||||
|
\"hip-star\",\n \"unicorn.example.io\": \"vcbait\"\n }\n}\n```"
|
||||||
usage: docker login [OPTIONS] [SERVER]
|
usage: docker login [OPTIONS] [SERVER]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -33,3 +65,4 @@ options:
|
||||||
- option: username
|
- option: username
|
||||||
shorthand: u
|
shorthand: u
|
||||||
description: Username
|
description: Username
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
command: docker logout
|
command: docker logout
|
||||||
short: Log out from a Docker registry
|
short: Log out from a Docker registry
|
||||||
long: "Log out of a Docker Registry located on the specified `SERVER`. You can\nspecify
|
long: Log out from a Docker registry
|
||||||
a URL or a `hostname` for the `SERVER` value. If you do not specify a\n`SERVER`,
|
|
||||||
the command attempts to log you out of Docker's public registry\nlocated at `https://registry-1.docker.io/`
|
|
||||||
by default. \n\n# EXAMPLES\n\n## Log out from a registry on your localhost\n\n
|
|
||||||
\ # docker logout localhost:8080\n\n# See also\n**docker-login(1)** to log in
|
|
||||||
to a Docker registry server.\n"
|
|
||||||
usage: docker logout [SERVER]
|
usage: docker logout [SERVER]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
example: |-
|
||||||
|
```bash
|
||||||
|
$ docker logout localhost:8080
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,41 @@
|
||||||
command: docker logs
|
command: docker logs
|
||||||
short: Fetch the logs of a container
|
short: Fetch the logs of a container
|
||||||
long: |
|
long: |-
|
||||||
Alias for `docker container logs`.
|
The `docker logs` command batch-retrieves logs present at the time of execution.
|
||||||
|
|
||||||
|
> **Note**: this command is only functional for containers that are started with
|
||||||
|
> the `json-file` or `journald` logging driver.
|
||||||
|
|
||||||
|
For more information about selecting and configuring logging drivers, refer to
|
||||||
|
[Configure logging drivers](https://docs.docker.com/engine/admin/logging/overview/).
|
||||||
|
|
||||||
|
The `docker logs --follow` command will continue streaming the new output from
|
||||||
|
the container's `STDOUT` and `STDERR`.
|
||||||
|
|
||||||
|
Passing a negative number or a non-integer to `--tail` is invalid and the
|
||||||
|
value is set to `all` in that case.
|
||||||
|
|
||||||
|
The `docker logs --timestamps` command will add an [RFC3339Nano timestamp](https://golang.org/pkg/time/#pkg-constants)
|
||||||
|
, for example `2014-09-16T06:17:46.000000000Z`, to each
|
||||||
|
log entry. To ensure that the timestamps are aligned the
|
||||||
|
nano-second part of the timestamp will be padded with zero when necessary.
|
||||||
|
|
||||||
|
The `docker logs --details` command will add on extra attributes, such as
|
||||||
|
environment variables and labels, provided to `--log-opt` when creating the
|
||||||
|
container.
|
||||||
|
|
||||||
|
The `--since` option shows only the container logs generated after
|
||||||
|
a given date. You can specify the date as an RFC 3339 date, a UNIX
|
||||||
|
timestamp, or a Go duration string (e.g. `1m30s`, `3h`). Besides RFC3339 date
|
||||||
|
format you may also use RFC3339Nano, `2006-01-02T15:04:05`,
|
||||||
|
`2006-01-02T15:04:05.999999999`, `2006-01-02Z07:00`, and `2006-01-02`. The local
|
||||||
|
timezone on the client will be used if you do not provide either a `Z` or a
|
||||||
|
`+-00:00` timezone offset at the end of the timestamp. When providing Unix
|
||||||
|
timestamps enter seconds[.nanoseconds], where seconds is the number of seconds
|
||||||
|
that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap
|
||||||
|
seconds (aka Unix epoch or Unix time), and the optional .nanoseconds field is a
|
||||||
|
fraction of a second no more than nine digits long. You can combine the
|
||||||
|
`--since` option with either or both of the `--follow` or `--tail` options.
|
||||||
usage: docker logs [OPTIONS] CONTAINER
|
usage: docker logs [OPTIONS] CONTAINER
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -23,3 +57,4 @@ options:
|
||||||
shorthand: t
|
shorthand: t
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Show timestamps
|
description: Show timestamps
|
||||||
|
|
||||||
|
|
|
@ -20,3 +20,4 @@ clink:
|
||||||
- docker_network_ls.yaml
|
- docker_network_ls.yaml
|
||||||
- docker_network_prune.yaml
|
- docker_network_prune.yaml
|
||||||
- docker_network_rm.yaml
|
- docker_network_rm.yaml
|
||||||
|
|
||||||
|
|
|
@ -1,45 +1,6 @@
|
||||||
command: docker network connect
|
command: docker network connect
|
||||||
short: Connect a container to a network
|
short: Connect a container to a network
|
||||||
long: |
|
long: Connect a container to a network
|
||||||
Connects a container to a network. You can connect a container by name
|
|
||||||
or by ID. Once connected, the container can communicate with other containers in
|
|
||||||
the same network.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ docker network connect multi-host-network container1
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also use the `docker run --network=<network-name>` option to start a container and immediately connect it to a network.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ docker run -itd --network=multi-host-network --ip 172.20.88.22 --ip6 2001:db8::8822 busybox
|
|
||||||
```
|
|
||||||
You can pause, restart, and stop containers that are connected to a network.
|
|
||||||
A container connects to its configured networks when it runs.
|
|
||||||
|
|
||||||
If specified, the container's IP address(es) is reapplied when a stopped
|
|
||||||
container is restarted. If the IP address is no longer available, the container
|
|
||||||
fails to start. One way to guarantee that the IP address is available is
|
|
||||||
to specify an `--ip-range` when creating the network, and choose the static IP
|
|
||||||
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.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ docker network create --subnet 172.20.0.0/16 --ip-range 172.20.240.0/20 multi-host-network
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ docker network connect --ip 172.20.128.2 multi-host-network container2
|
|
||||||
```
|
|
||||||
|
|
||||||
To verify the container is connected, use the `docker network inspect` command. Use `docker network disconnect` to remove a container from the network.
|
|
||||||
|
|
||||||
Once connected in network, containers can communicate using only another
|
|
||||||
container's IP address or name. For `overlay` networks or custom plugins that
|
|
||||||
support multi-host connectivity, containers connected to the same multi-host
|
|
||||||
network but launched from different Engines can also communicate in this way.
|
|
||||||
|
|
||||||
You can connect a container to one or more networks. The networks need not be the same type. For example, you can connect a single container bridge and overlay networks.
|
|
||||||
usage: docker network connect [OPTIONS] NETWORK CONTAINER
|
usage: docker network connect [OPTIONS] NETWORK CONTAINER
|
||||||
pname: docker network
|
pname: docker network
|
||||||
plink: docker_network.yaml
|
plink: docker_network.yaml
|
||||||
|
@ -57,3 +18,4 @@ options:
|
||||||
- option: link-local-ip
|
- option: link-local-ip
|
||||||
default_value: '[]'
|
default_value: '[]'
|
||||||
description: Add a link-local address for the container
|
description: Add a link-local address for the container
|
||||||
|
|
||||||
|
|
|
@ -1,63 +1,6 @@
|
||||||
command: docker network create
|
command: docker network create
|
||||||
short: Create a network
|
short: Create a network
|
||||||
long: "Creates a new network. The `DRIVER` accepts `bridge` or `overlay` which are
|
long: Create a network
|
||||||
the\nbuilt-in network drivers. If you have installed a third party or your own custom\nnetwork
|
|
||||||
driver you can specify that `DRIVER` here also. If you don't specify the\n`--driver`
|
|
||||||
option, the command automatically creates a `bridge` network for you.\nWhen you
|
|
||||||
install Docker Engine it creates a `bridge` network automatically. This\nnetwork
|
|
||||||
corresponds to the `docker0` bridge that Engine has traditionally relied\non. When
|
|
||||||
launch a new container with `docker run` it automatically connects to\nthis bridge
|
|
||||||
network. You cannot remove this default bridge network but you can\ncreate new ones
|
|
||||||
using the `network create` command.\n\n```bash\n$ docker network create -d bridge
|
|
||||||
my-bridge-network\n```\n\nBridge networks are isolated networks on a single Engine
|
|
||||||
installation. If you\nwant to create a network that spans multiple Docker hosts
|
|
||||||
each running an\nEngine, you must create an `overlay` network. Unlike `bridge` networks
|
|
||||||
overlay\nnetworks require some pre-existing conditions before you can create one.
|
|
||||||
These\nconditions are:\n\n* Access to a key-value store. Engine supports Consul,
|
|
||||||
Etcd, and Zookeeper (Distributed store) key-value stores.\n* A cluster of hosts
|
|
||||||
with connectivity to the key-value store.\n* A properly configured Engine `daemon`
|
|
||||||
on each host in the cluster.\n\nThe `dockerd` options that support the `overlay`
|
|
||||||
network are:\n\n* `--cluster-store`\n* `--cluster-store-opt`\n* `--cluster-advertise`\n\nTo
|
|
||||||
read more about these options and how to configure them, see [\"*Get started\nwith
|
|
||||||
multi-host\nnetwork*\"](https://docs.docker.com/engine/userguide/networking/get-started-overlay/).\n\nIt
|
|
||||||
is also a good idea, though not required, that you install Docker Swarm on to\nmanage
|
|
||||||
the cluster that makes up your network. Swarm provides sophisticated\ndiscovery
|
|
||||||
and server management that can assist your implementation.\n\nOnce you have prepared
|
|
||||||
the `overlay` network prerequisites you simply choose a\nDocker host in the cluster
|
|
||||||
and issue the following to create the network:\n\n```bash\n$ docker network create
|
|
||||||
-d overlay my-multihost-network\n```\n\nNetwork names must be unique. The Docker
|
|
||||||
daemon attempts to identify naming\nconflicts but this is not guaranteed. It is
|
|
||||||
the user's responsibility to avoid\nname conflicts.\n\n## Connect containers\n\nWhen
|
|
||||||
you start a container use the `--network` flag to connect it to a network.\nThis
|
|
||||||
adds the `busybox` container to the `mynet` network.\n\n```bash\n$ docker run -itd
|
|
||||||
--network=mynet busybox\n```\n\nIf you want to add a container to a network after
|
|
||||||
the container is already\nrunning use the `docker network connect` subcommand.\n\nYou
|
|
||||||
can connect multiple containers to the same network. Once connected, the\ncontainers
|
|
||||||
can communicate using only another container's IP address or name.\nFor `overlay`
|
|
||||||
networks or custom plugins that support multi-host connectivity,\ncontainers connected
|
|
||||||
to the same multi-host network but launched from different\nEngines can also communicate
|
|
||||||
in this way.\n\nYou can disconnect a container from a network using the `docker
|
|
||||||
network\ndisconnect` command.\n\n## Specifying advanced options\n\nWhen you create
|
|
||||||
a network, Engine creates a non-overlapping subnetwork for the\nnetwork by default.
|
|
||||||
This subnetwork is not a subdivision of an existing network.\nIt is purely for ip-addressing
|
|
||||||
purposes. You can override this default and\nspecify subnetwork values directly
|
|
||||||
using the `--subnet` option. On a\n`bridge` network you can only create a single
|
|
||||||
subnet:\n\n```bash\n$ docker network create -d bridge --subnet=192.168.0.0/16 br0\n```\n\nAdditionally,
|
|
||||||
you also specify the `--gateway` `--ip-range` and `--aux-address`\noptions.\n\n```bash\n$
|
|
||||||
docker network create \\\n --driver=bridge \\\n --subnet=172.28.0.0/16 \\\n --ip-range=172.28.5.0/24
|
|
||||||
\\\n --gateway=172.28.5.254 \\\n br0\n```\n\nIf you omit the `--gateway` flag
|
|
||||||
the Engine selects one for you from inside a\npreferred pool. For `overlay` networks
|
|
||||||
and for network driver plugins that\nsupport it you can create multiple subnetworks.\n\n```bash\n$
|
|
||||||
docker network create -d overlay \\\n --subnet=192.168.0.0/16 \\\n --subnet=192.170.0.0/16
|
|
||||||
\\\n --gateway=192.168.0.100 \\ \n --gateway=192.170.0.100 \\\n --ip-range=192.168.1.0/24
|
|
||||||
\\\n --aux-address=\"my-router=192.168.1.5\" --aux-address=\"my-switch=192.168.1.6\"
|
|
||||||
\\\n --aux-address=\"my-printer=192.170.1.5\" --aux-address=\"my-nas=192.170.1.6\"
|
|
||||||
\\\n my-multihost-network\n```\n\nBe sure that your subnetworks do not overlap.
|
|
||||||
If they do, the network create\nfails and Engine returns an error.\n\n### Network
|
|
||||||
internal mode\n\nBy default, when you connect a container to an `overlay` network,
|
|
||||||
Docker also\nconnects a bridge network to it to provide external connectivity. If
|
|
||||||
you want\nto create an externally isolated `overlay` network, you can specify the\n`--internal`
|
|
||||||
option.\n"
|
|
||||||
usage: docker network create [OPTIONS] NETWORK
|
usage: docker network create [OPTIONS] NETWORK
|
||||||
pname: docker network
|
pname: docker network
|
||||||
plink: docker_network.yaml
|
plink: docker_network.yaml
|
||||||
|
@ -100,3 +43,4 @@ options:
|
||||||
- option: subnet
|
- option: subnet
|
||||||
default_value: '[]'
|
default_value: '[]'
|
||||||
description: Subnet in CIDR format that represents a network segment
|
description: Subnet in CIDR format that represents a network segment
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
command: docker network disconnect
|
command: docker network disconnect
|
||||||
short: Disconnect a container from a network
|
short: Disconnect a container from a network
|
||||||
long: |
|
long: Disconnect a container from a network
|
||||||
Disconnects a container from a network.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ docker network disconnect multi-host-network container1
|
|
||||||
```
|
|
||||||
usage: docker network disconnect [OPTIONS] NETWORK CONTAINER
|
usage: docker network disconnect [OPTIONS] NETWORK CONTAINER
|
||||||
pname: docker network
|
pname: docker network
|
||||||
plink: docker_network.yaml
|
plink: docker_network.yaml
|
||||||
|
@ -14,3 +9,4 @@ options:
|
||||||
shorthand: f
|
shorthand: f
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Force the container to disconnect from a network
|
description: Force the container to disconnect from a network
|
||||||
|
|
||||||
|
|
|
@ -1,94 +1,6 @@
|
||||||
command: docker network inspect
|
command: docker network inspect
|
||||||
short: Display detailed information on one or more networks
|
short: Display detailed information on one or more networks
|
||||||
long: |
|
long: Display detailed information on one or more networks
|
||||||
Returns information about one or more networks. By default, this command renders all results in a JSON object. For example, if you connect two containers to the default `bridge` network:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ sudo docker run -itd --name=container1 busybox
|
|
||||||
f2870c98fd504370fb86e59f32cd0753b1ac9b69b7d80566ffc7192a82b3ed27
|
|
||||||
|
|
||||||
$ sudo docker run -itd --name=container2 busybox
|
|
||||||
bda12f8922785d1f160be70736f26c1e331ab8aaf8ed8d56728508f2e2fd4727
|
|
||||||
```
|
|
||||||
|
|
||||||
The `network inspect` command shows the containers, by id, in its
|
|
||||||
results. You can specify an alternate format to execute a given
|
|
||||||
template for each result. Go's
|
|
||||||
[text/template](http://golang.org/pkg/text/template/) package
|
|
||||||
describes all the details of the format.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ sudo docker network inspect bridge
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"Name": "bridge",
|
|
||||||
"Id": "b2b1a2cba717161d984383fd68218cf70bbbd17d328496885f7c921333228b0f",
|
|
||||||
"Scope": "local",
|
|
||||||
"Driver": "bridge",
|
|
||||||
"IPAM": {
|
|
||||||
"Driver": "default",
|
|
||||||
"Config": [
|
|
||||||
{
|
|
||||||
"Subnet": "172.17.42.1/16",
|
|
||||||
"Gateway": "172.17.42.1"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Internal": false,
|
|
||||||
"Containers": {
|
|
||||||
"bda12f8922785d1f160be70736f26c1e331ab8aaf8ed8d56728508f2e2fd4727": {
|
|
||||||
"Name": "container2",
|
|
||||||
"EndpointID": "0aebb8fcd2b282abe1365979536f21ee4ceaf3ed56177c628eae9f706e00e019",
|
|
||||||
"MacAddress": "02:42:ac:11:00:02",
|
|
||||||
"IPv4Address": "172.17.0.2/16",
|
|
||||||
"IPv6Address": ""
|
|
||||||
},
|
|
||||||
"f2870c98fd504370fb86e59f32cd0753b1ac9b69b7d80566ffc7192a82b3ed27": {
|
|
||||||
"Name": "container1",
|
|
||||||
"EndpointID": "a00676d9c91a96bbe5bcfb34f705387a33d7cc365bac1a29e4e9728df92d10ad",
|
|
||||||
"MacAddress": "02:42:ac:11:00:01",
|
|
||||||
"IPv4Address": "172.17.0.1/16",
|
|
||||||
"IPv6Address": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Options": {
|
|
||||||
"com.docker.network.bridge.default_bridge": "true",
|
|
||||||
"com.docker.network.bridge.enable_icc": "true",
|
|
||||||
"com.docker.network.bridge.enable_ip_masquerade": "true",
|
|
||||||
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
|
|
||||||
"com.docker.network.bridge.name": "docker0",
|
|
||||||
"com.docker.network.driver.mtu": "1500"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
Returns the information about the user-defined network:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ docker network create simple-network
|
|
||||||
69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a
|
|
||||||
$ docker network inspect simple-network
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"Name": "simple-network",
|
|
||||||
"Id": "69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a",
|
|
||||||
"Scope": "local",
|
|
||||||
"Driver": "bridge",
|
|
||||||
"IPAM": {
|
|
||||||
"Driver": "default",
|
|
||||||
"Config": [
|
|
||||||
{
|
|
||||||
"Subnet": "172.22.0.0/16",
|
|
||||||
"Gateway": "172.22.0.1"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Containers": {},
|
|
||||||
"Options": {}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
```
|
|
||||||
usage: docker network inspect [OPTIONS] NETWORK [NETWORK...]
|
usage: docker network inspect [OPTIONS] NETWORK [NETWORK...]
|
||||||
pname: docker network
|
pname: docker network
|
||||||
plink: docker_network.yaml
|
plink: docker_network.yaml
|
||||||
|
@ -96,3 +8,4 @@ options:
|
||||||
- option: format
|
- option: format
|
||||||
shorthand: f
|
shorthand: f
|
||||||
description: Format the output using the given Go template
|
description: Format the output using the given Go template
|
||||||
|
|
||||||
|
|
|
@ -1,67 +1,7 @@
|
||||||
command: docker network ls
|
command: docker network ls
|
||||||
aliases: list
|
aliases: list
|
||||||
short: List networks
|
short: List networks
|
||||||
long: "Lists all the networks the Engine `daemon` knows about. This includes the\nnetworks
|
long: List networks
|
||||||
that span across multiple hosts in a cluster, for example:\n\n```bash\n $ docker
|
|
||||||
network ls\n NETWORK ID NAME DRIVER SCOPE\n
|
|
||||||
\ 7fca4eb8c647 bridge bridge local\n 9f904ee27bf5
|
|
||||||
\ none null local\n cf03ee007fb4 host
|
|
||||||
\ host local\n 78b03ee04fc4 multi-host overlay
|
|
||||||
\ swarm\n```\n\nUse the `--no-trunc` option to display the full network id:\n\n```bash\n$
|
|
||||||
docker network ls --no-trunc\nNETWORK ID NAME
|
|
||||||
\ DRIVER\n18a2866682b85619a026c81b98a5e375bd33e1b0936a26cc497c283d27bae9b3
|
|
||||||
\ none null \nc288470c46f6c8949c5f7e5099b5b7947b07eabe8d9a27d79a9cbf111adcbf47
|
|
||||||
\ host host \n7b369448dccbf865d397c8d2be0cda7cf7edc6b0945f77d2529912ae917a0185
|
|
||||||
\ bridge bridge \n95e74588f40db048e86320c6526440c504650a1ff3e9f7d60a497c4d2163e5bd
|
|
||||||
\ foo bridge \n63d1ff1f77b07ca51070a8c227e962238358bd310bde1529cf62e6c307ade161
|
|
||||||
\ dev bridge\n```\n\n## Filtering\n\nThe filtering flag (`-f` or
|
|
||||||
`--filter`) format is a `key=value` pair. If there\nis more than one filter, then
|
|
||||||
pass multiple flags (e.g. `--filter \"foo=bar\" --filter \"bif=baz\"`).\nMultiple
|
|
||||||
filter flags are combined as an `OR` filter. For example, \n`-f type=custom -f type=builtin`
|
|
||||||
returns both `custom` and `builtin` networks.\n\nThe currently supported filters
|
|
||||||
are:\n\n* driver\n* id (network's id)\n* label (`label=<key>` or `label=<key>=<value>`)\n*
|
|
||||||
name (network's name)\n* type (custom|builtin)\n\n#### Driver\n\nThe `driver` filter
|
|
||||||
matches networks based on their driver.\n\nThe following example matches networks
|
|
||||||
with the `bridge` driver:\n\n```bash\n$ docker network ls --filter driver=bridge\nNETWORK
|
|
||||||
ID NAME DRIVER\ndb9db329f835 test1 bridge\nf6e212da9dfd
|
|
||||||
\ test2 bridge\n```\n\n#### ID\n\nThe `id` filter matches on
|
|
||||||
all or part of a network's ID.\n\nThe following filter matches all networks with
|
|
||||||
an ID containing the\n`63d1ff1f77b0...` string.\n\n```bash\n$ docker network ls
|
|
||||||
--filter id=63d1ff1f77b07ca51070a8c227e962238358bd310bde1529cf62e6c307ade161\nNETWORK
|
|
||||||
ID NAME DRIVER\n63d1ff1f77b0 dev bridge\n```\n\nYou
|
|
||||||
can also filter for a substring in an ID as this shows:\n\n```bash\n$ docker network
|
|
||||||
ls --filter id=95e74588f40d\nNETWORK ID NAME DRIVER\n95e74588f40d
|
|
||||||
\ foo bridge\n\n$ docker network ls --filter id=95e\nNETWORK
|
|
||||||
ID NAME DRIVER\n95e74588f40d foo bridge\n```\n\n####
|
|
||||||
Label\n\nThe `label` filter matches networks based on the presence of a `label`
|
|
||||||
alone or a `label` and a\nvalue.\n\nThe following filter matches networks with the
|
|
||||||
`usage` label regardless of its value.\n\n```bash\n$ docker network ls -f \"label=usage\"\nNETWORK
|
|
||||||
ID NAME DRIVER\ndb9db329f835 test1 bridge
|
|
||||||
\ \nf6e212da9dfd test2 bridge\n```\n\nThe following
|
|
||||||
filter matches networks with the `usage` label with the `prod` value.\n\n```bash\n$
|
|
||||||
docker network ls -f \"label=usage=prod\"\nNETWORK ID NAME DRIVER\nf6e212da9dfd
|
|
||||||
\ test2 bridge\n```\n\n#### Name\n\nThe `name` filter matches
|
|
||||||
on all or part of a network's name.\n\nThe following filter matches all networks
|
|
||||||
with a name containing the `foobar` string.\n\n```bash\n$ docker network ls --filter
|
|
||||||
name=foobar\nNETWORK ID NAME DRIVER\n06e7eef0a170 foobar
|
|
||||||
\ bridge\n```\n\nYou can also filter for a substring in a name as this
|
|
||||||
shows:\n\n```bash\n$ docker network ls --filter name=foo\nNETWORK ID NAME
|
|
||||||
\ DRIVER\n95e74588f40d foo bridge\n06e7eef0a170
|
|
||||||
\ foobar bridge\n```\n\n#### Type\n\nThe `type` filter supports
|
|
||||||
two values; `builtin` displays predefined networks\n(`bridge`, `none`, `host`),
|
|
||||||
whereas `custom` displays user defined networks.\n\nThe following filter matches
|
|
||||||
all user defined networks:\n\n```bash\n$ docker network ls --filter type=custom\nNETWORK
|
|
||||||
ID NAME DRIVER\n95e74588f40d foo bridge\n63d1ff1f77b0
|
|
||||||
\ dev bridge\n```\n\nBy having this flag it allows for batch
|
|
||||||
cleanup. For example, use this filter\nto delete all user defined networks:\n\n```bash\n$
|
|
||||||
docker network rm `docker network ls --filter type=custom -q`\n```\n\nA warning
|
|
||||||
will be issued when trying to remove a network that has containers\nattached.\n\n##
|
|
||||||
Format\n\nFormat uses a Go template to print the output. The following variables
|
|
||||||
are \nsupported: \n\n* .ID - Network ID\n* .Name - Network name\n* .Driver - Network
|
|
||||||
driver\n* .Scope - Network scope (local, global)\n* .IPv6 - Whether IPv6 is enabled
|
|
||||||
on the network or not\n* .Internal - Whether the network is internal or not\n* .Labels
|
|
||||||
- All labels assigned to the network\n* .Label - Value of a specific label for this
|
|
||||||
network. For example `{{.Label \"project.version\"}}`\n"
|
|
||||||
usage: docker network ls [OPTIONS]
|
usage: docker network ls [OPTIONS]
|
||||||
pname: docker network
|
pname: docker network
|
||||||
plink: docker_network.yaml
|
plink: docker_network.yaml
|
||||||
|
@ -78,3 +18,4 @@ options:
|
||||||
shorthand: q
|
shorthand: q
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Only display network IDs
|
description: Only display network IDs
|
||||||
|
|
||||||
|
|
|
@ -11,3 +11,4 @@ options:
|
||||||
shorthand: f
|
shorthand: f
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Do not prompt for confirmation
|
description: Do not prompt for confirmation
|
||||||
|
|
||||||
|
|
|
@ -1,27 +1,8 @@
|
||||||
command: docker network rm
|
command: docker network rm
|
||||||
aliases: remove
|
aliases: remove
|
||||||
short: Remove one or more networks
|
short: Remove one or more networks
|
||||||
long: |
|
long: Remove one or more networks
|
||||||
Removes one or more networks by name or identifier. To remove a network,
|
|
||||||
you must first disconnect any containers connected to it.
|
|
||||||
To remove the network named 'my-network':
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ docker network rm my-network
|
|
||||||
```
|
|
||||||
|
|
||||||
To delete multiple networks in a single `docker network rm` command, provide
|
|
||||||
multiple network names or ids. The following example deletes a network with id
|
|
||||||
`3695c422697f` and a network named `my-network`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ docker network rm 3695c422697f my-network
|
|
||||||
```
|
|
||||||
|
|
||||||
When you specify multiple networks, the command attempts to delete each in turn.
|
|
||||||
If the deletion of one network fails, the command continues to the next on the
|
|
||||||
list and tries to delete that. The command reports success or failure for each
|
|
||||||
deletion.
|
|
||||||
usage: docker network rm NETWORK [NETWORK...]
|
usage: docker network rm NETWORK [NETWORK...]
|
||||||
pname: docker network
|
pname: docker network
|
||||||
plink: docker_network.yaml
|
plink: docker_network.yaml
|
||||||
|
|
||||||
|
|
|
@ -20,3 +20,4 @@ clink:
|
||||||
- docker_node_ps.yaml
|
- docker_node_ps.yaml
|
||||||
- docker_node_rm.yaml
|
- docker_node_rm.yaml
|
||||||
- docker_node_update.yaml
|
- docker_node_update.yaml
|
||||||
|
|
||||||
|
|
|
@ -4,3 +4,4 @@ long: Demote one or more nodes from manager in the swarm
|
||||||
usage: docker node demote NODE [NODE...]
|
usage: docker node demote NODE [NODE...]
|
||||||
pname: docker node
|
pname: docker node
|
||||||
plink: docker_node.yaml
|
plink: docker_node.yaml
|
||||||
|
|
||||||
|
|
|
@ -11,3 +11,4 @@ options:
|
||||||
- option: pretty
|
- option: pretty
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Print the information in a human friendly format.
|
description: Print the information in a human friendly format.
|
||||||
|
|
||||||
|
|
|
@ -13,3 +13,4 @@ options:
|
||||||
shorthand: q
|
shorthand: q
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Only display IDs
|
description: Only display IDs
|
||||||
|
|
||||||
|
|
|
@ -4,3 +4,4 @@ long: Promote one or more nodes to manager in the swarm
|
||||||
usage: docker node promote NODE [NODE...]
|
usage: docker node promote NODE [NODE...]
|
||||||
pname: docker node
|
pname: docker node
|
||||||
plink: docker_node.yaml
|
plink: docker_node.yaml
|
||||||
|
|
||||||
|
|
|
@ -14,3 +14,4 @@ options:
|
||||||
- option: no-trunc
|
- option: no-trunc
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Do not truncate output
|
description: Do not truncate output
|
||||||
|
|
||||||
|
|
|
@ -10,3 +10,4 @@ options:
|
||||||
shorthand: f
|
shorthand: f
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Force remove a node from the swarm
|
description: Force remove a node from the swarm
|
||||||
|
|
||||||
|
|
|
@ -15,3 +15,4 @@ options:
|
||||||
description: Remove a node label if exists
|
description: Remove a node label if exists
|
||||||
- option: role
|
- option: role
|
||||||
description: Role of the node (worker/manager)
|
description: Role of the node (worker/manager)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,21 @@
|
||||||
command: docker pause
|
command: docker pause
|
||||||
short: Pause all processes within one or more containers
|
short: Pause all processes within one or more containers
|
||||||
long: |
|
long: |-
|
||||||
Alias for `docker container pause`.
|
The `docker pause` command suspends all processes in the specified containers.
|
||||||
|
On Linux, this uses the cgroups freezer. Traditionally, when suspending a process
|
||||||
|
the `SIGSTOP` signal is used, which is observable by the process being suspended.
|
||||||
|
With the cgroups freezer the process is unaware, and unable to capture,
|
||||||
|
that it is being suspended, and subsequently resumed. On Windows, only Hyper-V
|
||||||
|
containers can be paused.
|
||||||
|
|
||||||
|
See the
|
||||||
|
[cgroups freezer documentation](https://www.kernel.org/doc/Documentation/cgroup-v1/freezer-subsystem.txt)
|
||||||
|
for further details.
|
||||||
usage: docker pause CONTAINER [CONTAINER...]
|
usage: docker pause CONTAINER [CONTAINER...]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
example: |-
|
||||||
|
```bash
|
||||||
|
$ docker pause my_container
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ cname:
|
||||||
- docker plugin push
|
- docker plugin push
|
||||||
- docker plugin rm
|
- docker plugin rm
|
||||||
- docker plugin set
|
- docker plugin set
|
||||||
|
- docker plugin upgrade
|
||||||
clink:
|
clink:
|
||||||
- docker_plugin_create.yaml
|
- docker_plugin_create.yaml
|
||||||
- docker_plugin_disable.yaml
|
- docker_plugin_disable.yaml
|
||||||
|
@ -24,3 +25,5 @@ clink:
|
||||||
- docker_plugin_push.yaml
|
- docker_plugin_push.yaml
|
||||||
- docker_plugin_rm.yaml
|
- docker_plugin_rm.yaml
|
||||||
- docker_plugin_set.yaml
|
- docker_plugin_set.yaml
|
||||||
|
- docker_plugin_upgrade.yaml
|
||||||
|
|
||||||
|
|
|
@ -10,3 +10,4 @@ options:
|
||||||
- option: compress
|
- option: compress
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Compress the context using gzip
|
description: Compress the context using gzip
|
||||||
|
|
||||||
|
|
|
@ -9,3 +9,4 @@ options:
|
||||||
shorthand: f
|
shorthand: f
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Force the disable of an active plugin
|
description: Force the disable of an active plugin
|
||||||
|
|
||||||
|
|
|
@ -8,3 +8,4 @@ options:
|
||||||
- option: timeout
|
- option: timeout
|
||||||
default_value: "0"
|
default_value: "0"
|
||||||
description: HTTP client timeout (in seconds)
|
description: HTTP client timeout (in seconds)
|
||||||
|
|
||||||
|
|
|
@ -8,3 +8,4 @@ options:
|
||||||
- option: format
|
- option: format
|
||||||
shorthand: f
|
shorthand: f
|
||||||
description: Format the output using the given Go template
|
description: Format the output using the given Go template
|
||||||
|
|
||||||
|
|
|
@ -16,3 +16,4 @@ options:
|
||||||
- option: grant-all-permissions
|
- option: grant-all-permissions
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Grant all permissions necessary to run the plugin
|
description: Grant all permissions necessary to run the plugin
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,9 @@ usage: docker plugin ls [OPTIONS]
|
||||||
pname: docker plugin
|
pname: docker plugin
|
||||||
plink: docker_plugin.yaml
|
plink: docker_plugin.yaml
|
||||||
options:
|
options:
|
||||||
|
- option: filter
|
||||||
|
shorthand: f
|
||||||
|
description: Provide filter values (e.g. 'enabled=true')
|
||||||
- option: format
|
- option: format
|
||||||
description: Pretty-print plugins using a Go template
|
description: Pretty-print plugins using a Go template
|
||||||
- option: no-trunc
|
- option: no-trunc
|
||||||
|
@ -15,3 +18,4 @@ options:
|
||||||
shorthand: q
|
shorthand: q
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Only display plugin IDs
|
description: Only display plugin IDs
|
||||||
|
|
||||||
|
|
|
@ -8,3 +8,4 @@ options:
|
||||||
- option: disable-content-trust
|
- option: disable-content-trust
|
||||||
default_value: "true"
|
default_value: "true"
|
||||||
description: Skip image signing
|
description: Skip image signing
|
||||||
|
|
||||||
|
|
|
@ -10,3 +10,4 @@ options:
|
||||||
shorthand: f
|
shorthand: f
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Force the removal of an active plugin
|
description: Force the removal of an active plugin
|
||||||
|
|
||||||
|
|
|
@ -4,3 +4,4 @@ long: Change settings for a plugin
|
||||||
usage: docker plugin set PLUGIN KEY=VALUE [KEY=VALUE...]
|
usage: docker plugin set PLUGIN KEY=VALUE [KEY=VALUE...]
|
||||||
pname: docker plugin
|
pname: docker plugin
|
||||||
plink: docker_plugin.yaml
|
plink: docker_plugin.yaml
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
command: docker plugin upgrade
|
||||||
|
short: Upgrade an existing plugin
|
||||||
|
long: Upgrade an existing plugin
|
||||||
|
usage: docker plugin upgrade [OPTIONS] PLUGIN [REMOTE]
|
||||||
|
pname: docker plugin
|
||||||
|
plink: docker_plugin.yaml
|
||||||
|
options:
|
||||||
|
- option: disable-content-trust
|
||||||
|
default_value: "true"
|
||||||
|
description: Skip image verification
|
||||||
|
- option: grant-all-permissions
|
||||||
|
default_value: "false"
|
||||||
|
description: Grant all permissions necessary to run the plugin
|
||||||
|
- option: skip-remote-check
|
||||||
|
default_value: "false"
|
||||||
|
description: |
|
||||||
|
Do not check if specified remote plugin matches existing plugin image
|
||||||
|
|
|
@ -1,7 +1,27 @@
|
||||||
command: docker port
|
command: docker port
|
||||||
short: List port mappings or a specific mapping for the container
|
short: List port mappings or a specific mapping for the container
|
||||||
long: |
|
long: List port mappings or a specific mapping for the container
|
||||||
Alias for `docker container port`.
|
|
||||||
usage: docker port CONTAINER [PRIVATE_PORT[/PROTO]]
|
usage: docker port CONTAINER [PRIVATE_PORT[/PROTO]]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
example: |-
|
||||||
|
### Show all mapped ports
|
||||||
|
|
||||||
|
You can find out all the ports mapped by not specifying a `PRIVATE_PORT`, or
|
||||||
|
just a specific mapping:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
b650456536c7 busybox:latest top 54 minutes ago Up 54 minutes 0.0.0.0:1234->9876/tcp, 0.0.0.0:4321->7890/tcp test
|
||||||
|
$ docker port test
|
||||||
|
7890/tcp -> 0.0.0.0:4321
|
||||||
|
9876/tcp -> 0.0.0.0:1234
|
||||||
|
$ docker port test 7890/tcp
|
||||||
|
0.0.0.0:4321
|
||||||
|
$ docker port test 7890/udp
|
||||||
|
2014/06/24 11:53:36 Error: No public port '7890/udp' published for test
|
||||||
|
$ docker port test 7890
|
||||||
|
0.0.0.0:4321
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
command: docker ps
|
command: docker ps
|
||||||
short: List containers
|
short: List containers
|
||||||
long: |
|
long: List containers
|
||||||
Alias for `docker container ls`.
|
|
||||||
usage: docker ps [OPTIONS]
|
usage: docker ps [OPTIONS]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -34,3 +33,393 @@ options:
|
||||||
shorthand: s
|
shorthand: s
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Display total file sizes
|
description: Display total file sizes
|
||||||
|
example: |-
|
||||||
|
### Prevent truncating output
|
||||||
|
|
||||||
|
Running `docker ps --no-trunc` showing 2 linked containers.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
4c01db0b339c ubuntu:12.04 bash 17 seconds ago Up 16 seconds 3300-3310/tcp webapp
|
||||||
|
d7886598dbe2 crosbymichael/redis:latest /redis-server --dir 33 minutes ago Up 33 minutes 6379/tcp redis,webapp/db
|
||||||
|
```
|
||||||
|
|
||||||
|
### Show both running and stopped containers
|
||||||
|
|
||||||
|
The `docker ps` command only shows running containers by default. To see all
|
||||||
|
containers, use the `-a` (or `--all`) flag:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps -a
|
||||||
|
```
|
||||||
|
|
||||||
|
`docker ps` groups exposed ports into a single range if possible. E.g., a
|
||||||
|
container that exposes TCP ports `100, 101, 102` displays `100-102/tcp` in
|
||||||
|
the `PORTS` column.
|
||||||
|
|
||||||
|
### Filtering
|
||||||
|
|
||||||
|
The filtering flag (`-f` or `--filter`) format is a `key=value` pair. If there is more
|
||||||
|
than one filter, then pass multiple flags (e.g. `--filter "foo=bar" --filter "bif=baz"`)
|
||||||
|
|
||||||
|
The currently supported filters are:
|
||||||
|
|
||||||
|
* id (container's id)
|
||||||
|
* label (`label=<key>` or `label=<key>=<value>`)
|
||||||
|
* name (container's name)
|
||||||
|
* exited (int - the code of exited containers. Only useful with `--all`)
|
||||||
|
* status (created|restarting|running|removing|paused|exited|dead)
|
||||||
|
* ancestor (`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`) - filters containers that were created from the given image or a descendant.
|
||||||
|
* before (container's id or name) - filters containers created before given id or name
|
||||||
|
* since (container's id or name) - filters containers created since given id or name
|
||||||
|
* isolation (default|process|hyperv) (Windows daemon only)
|
||||||
|
* volume (volume name or mount point) - filters containers that mount volumes.
|
||||||
|
* network (network id or name) - filters containers connected to the provided network
|
||||||
|
* health (starting|healthy|unhealthy|none) - filters containers based on healthcheck status
|
||||||
|
* publish=(container's published port) - filters published ports by containers
|
||||||
|
* expose=(container's exposed port) - filters exposed ports by containers
|
||||||
|
|
||||||
|
#### label
|
||||||
|
|
||||||
|
The `label` filter matches containers based on the presence of a `label` alone or a `label` and a
|
||||||
|
value.
|
||||||
|
|
||||||
|
The following filter matches containers with the `color` label regardless of its value.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps --filter "label=color"
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
673394ef1d4c busybox "top" 47 seconds ago Up 45 seconds nostalgic_shockley
|
||||||
|
d85756f57265 busybox "top" 52 seconds ago Up 51 seconds high_albattani
|
||||||
|
```
|
||||||
|
|
||||||
|
The following filter matches containers with the `color` label with the `blue` value.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps --filter "label=color=blue"
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
d85756f57265 busybox "top" About a minute ago Up About a minute high_albattani
|
||||||
|
```
|
||||||
|
|
||||||
|
#### name
|
||||||
|
|
||||||
|
The `name` filter matches on all or part of a container's name.
|
||||||
|
|
||||||
|
The following filter matches all containers with a name containing the `nostalgic_stallman` string.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps --filter "name=nostalgic_stallman"
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
9b6247364a03 busybox "top" 2 minutes ago Up 2 minutes nostalgic_stallman
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also filter for a substring in a name as this shows:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps --filter "name=nostalgic"
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
715ebfcee040 busybox "top" 3 seconds ago Up 1 second i_am_nostalgic
|
||||||
|
9b6247364a03 busybox "top" 7 minutes ago Up 7 minutes nostalgic_stallman
|
||||||
|
673394ef1d4c busybox "top" 38 minutes ago Up 38 minutes nostalgic_shockley
|
||||||
|
```
|
||||||
|
|
||||||
|
#### exited
|
||||||
|
|
||||||
|
The `exited` filter matches containers by exist status code. For example, to
|
||||||
|
filter for containers that have exited successfully:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps -a --filter 'exited=0'
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
ea09c3c82f6e registry:latest /srv/run.sh 2 weeks ago Exited (0) 2 weeks ago 127.0.0.1:5000->5000/tcp desperate_leakey
|
||||||
|
106ea823fe4e fedora:latest /bin/sh -c 'bash -l' 2 weeks ago Exited (0) 2 weeks ago determined_albattani
|
||||||
|
48ee228c9464 fedora:20 bash 2 weeks ago Exited (0) 2 weeks ago tender_torvalds
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Filter by exit signal
|
||||||
|
|
||||||
|
You can use a filter to locate containers that exited with status of `137`
|
||||||
|
meaning a `SIGKILL(9)` killed them.
|
||||||
|
|
||||||
|
```none
|
||||||
|
$ docker ps -a --filter 'exited=137'
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
b3e1c0ed5bfe ubuntu:latest "sleep 1000" 12 seconds ago Exited (137) 5 seconds ago grave_kowalevski
|
||||||
|
a2eb5558d669 redis:latest "/entrypoint.sh redi 2 hours ago Exited (137) 2 hours ago sharp_lalande
|
||||||
|
```
|
||||||
|
|
||||||
|
Any of these events result in a `137` status:
|
||||||
|
|
||||||
|
* the `init` process of the container is killed manually
|
||||||
|
* `docker kill` kills the container
|
||||||
|
* Docker daemon restarts which kills all running containers
|
||||||
|
|
||||||
|
#### status
|
||||||
|
|
||||||
|
The `status` filter matches containers by status. You can filter using
|
||||||
|
`created`, `restarting`, `running`, `removing`, `paused`, `exited` and `dead`. For example,
|
||||||
|
to filter for `running` containers:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps --filter status=running
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
715ebfcee040 busybox "top" 16 minutes ago Up 16 minutes i_am_nostalgic
|
||||||
|
d5c976d3c462 busybox "top" 23 minutes ago Up 23 minutes top
|
||||||
|
9b6247364a03 busybox "top" 24 minutes ago Up 24 minutes nostalgic_stallman
|
||||||
|
```
|
||||||
|
|
||||||
|
To filter for `paused` containers:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps --filter status=paused
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
673394ef1d4c busybox "top" About an hour ago Up About an hour (Paused) nostalgic_shockley
|
||||||
|
```
|
||||||
|
|
||||||
|
#### ancestor
|
||||||
|
|
||||||
|
The `ancestor` filter matches containers based on its image or a descendant of
|
||||||
|
it. The filter supports the following image representation:
|
||||||
|
|
||||||
|
- image
|
||||||
|
- image:tag
|
||||||
|
- image:tag@digest
|
||||||
|
- short-id
|
||||||
|
- full-id
|
||||||
|
|
||||||
|
If you don't specify a `tag`, the `latest` tag is used. For example, to filter
|
||||||
|
for containers that use the latest `ubuntu` image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps --filter ancestor=ubuntu
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
919e1179bdb8 ubuntu-c1 "top" About a minute ago Up About a minute admiring_lovelace
|
||||||
|
5d1e4a540723 ubuntu-c2 "top" About a minute ago Up About a minute admiring_sammet
|
||||||
|
82a598284012 ubuntu "top" 3 minutes ago Up 3 minutes sleepy_bose
|
||||||
|
bab2a34ba363 ubuntu "top" 3 minutes ago Up 3 minutes focused_yonath
|
||||||
|
```
|
||||||
|
|
||||||
|
Match containers based on the `ubuntu-c1` image which, in this case, is a child
|
||||||
|
of `ubuntu`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps --filter ancestor=ubuntu-c1
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
919e1179bdb8 ubuntu-c1 "top" About a minute ago Up About a minute admiring_lovelace
|
||||||
|
```
|
||||||
|
|
||||||
|
Match containers based on the `ubuntu` version `12.04.5` image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps --filter ancestor=ubuntu:12.04.5
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
82a598284012 ubuntu:12.04.5 "top" 3 minutes ago Up 3 minutes sleepy_bose
|
||||||
|
```
|
||||||
|
|
||||||
|
The following matches containers based on the layer `d0e008c6cf02` or an image
|
||||||
|
that have this layer in its layer stack.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps --filter ancestor=d0e008c6cf02
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
82a598284012 ubuntu:12.04.5 "top" 3 minutes ago Up 3 minutes sleepy_bose
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Create time
|
||||||
|
|
||||||
|
##### before
|
||||||
|
|
||||||
|
The `before` filter shows only containers created before the container with
|
||||||
|
given id or name. For example, having these containers created:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
9c3527ed70ce busybox "top" 14 seconds ago Up 15 seconds desperate_dubinsky
|
||||||
|
4aace5031105 busybox "top" 48 seconds ago Up 49 seconds focused_hamilton
|
||||||
|
6e63f6ff38b0 busybox "top" About a minute ago Up About a minute distracted_fermat
|
||||||
|
```
|
||||||
|
|
||||||
|
Filtering with `before` would give:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps -f before=9c3527ed70ce
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
4aace5031105 busybox "top" About a minute ago Up About a minute focused_hamilton
|
||||||
|
6e63f6ff38b0 busybox "top" About a minute ago Up About a minute distracted_fermat
|
||||||
|
```
|
||||||
|
|
||||||
|
##### since
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps -f since=6e63f6ff38b0
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
9c3527ed70ce busybox "top" 10 minutes ago Up 10 minutes desperate_dubinsky
|
||||||
|
4aace5031105 busybox "top" 10 minutes ago Up 10 minutes focused_hamilton
|
||||||
|
```
|
||||||
|
|
||||||
|
#### volume
|
||||||
|
|
||||||
|
The `volume` filter shows only containers that mount a specific volume or have
|
||||||
|
a volume mounted in a specific path:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{% raw %}
|
||||||
|
$ docker ps --filter volume=remote-volume --format "table {{.ID}}\t{{.Mounts}}"
|
||||||
|
CONTAINER ID MOUNTS
|
||||||
|
9c3527ed70ce remote-volume
|
||||||
|
|
||||||
|
$ docker ps --filter volume=/data --format "table {{.ID}}\t{{.Mounts}}"
|
||||||
|
CONTAINER ID MOUNTS
|
||||||
|
9c3527ed70ce remote-volume
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### network
|
||||||
|
|
||||||
|
The `network` filter shows only containers that are connected to a network with
|
||||||
|
a given name or id.
|
||||||
|
|
||||||
|
The following filter matches all containers that are connected to a network
|
||||||
|
with a name containing `net1`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker run -d --net=net1 --name=test1 ubuntu top
|
||||||
|
$ docker run -d --net=net2 --name=test2 ubuntu top
|
||||||
|
|
||||||
|
$ docker ps --filter network=net1
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
9d4893ed80fe ubuntu "top" 10 minutes ago Up 10 minutes test1
|
||||||
|
```
|
||||||
|
|
||||||
|
The network filter matches on both the network's name and id. The following
|
||||||
|
example shows all containers that are attached to the `net1` network, using
|
||||||
|
the network id as a filter;
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{% raw %}
|
||||||
|
$ docker network inspect --format "{{.ID}}" net1
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
|
8c0b4110ae930dbe26b258de9bc34a03f98056ed6f27f991d32919bfe401d7c5
|
||||||
|
|
||||||
|
$ docker ps --filter network=8c0b4110ae930dbe26b258de9bc34a03f98056ed6f27f991d32919bfe401d7c5
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
9d4893ed80fe ubuntu "top" 10 minutes ago Up 10 minutes test1
|
||||||
|
```
|
||||||
|
|
||||||
|
#### publish and expose
|
||||||
|
|
||||||
|
The `publish` and `expose` filters show only containers that have published or exposed port with a given port
|
||||||
|
number, port range, and/or protocol. The default protocol is `tcp` when not specified.
|
||||||
|
|
||||||
|
The following filter matches all containers that have published port of 80:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker run -d --publish=80 busybox top
|
||||||
|
$ docker run -d --expose=8080 busybox top
|
||||||
|
|
||||||
|
$ docker ps -a
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
9833437217a5 busybox "top" 5 seconds ago Up 4 seconds 8080/tcp dreamy_mccarthy
|
||||||
|
fc7e477723b7 busybox "top" 50 seconds ago Up 50 seconds 0.0.0.0:32768->80/tcp admiring_roentgen
|
||||||
|
|
||||||
|
$ docker ps --filter publish=80
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
fc7e477723b7 busybox "top" About a minute ago Up About a minute 0.0.0.0:32768->80/tcp admiring_roentgen
|
||||||
|
```
|
||||||
|
|
||||||
|
The following filter matches all containers that have exposed TCP port in the range of `8000-8080`:
|
||||||
|
```bash
|
||||||
|
$ docker ps --filter expose=8000-8080/tcp
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
9833437217a5 busybox "top" 21 seconds ago Up 19 seconds 8080/tcp dreamy_mccarthy
|
||||||
|
```
|
||||||
|
|
||||||
|
The following filter matches all containers that have exposed UDP port `80`:
|
||||||
|
```bash
|
||||||
|
$ docker ps --filter publish=80/udp
|
||||||
|
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
```
|
||||||
|
|
||||||
|
### Formatting
|
||||||
|
|
||||||
|
The formatting option (`--format`) pretty-prints container output using a Go
|
||||||
|
template.
|
||||||
|
|
||||||
|
Valid placeholders for the Go template are listed below:
|
||||||
|
|
||||||
|
Placeholder | Description
|
||||||
|
--------------|----------------------------------------------------------------------------------------------------
|
||||||
|
`.ID` | Container ID
|
||||||
|
`.Image` | Image ID
|
||||||
|
`.Command` | Quoted command
|
||||||
|
`.CreatedAt` | Time when the container was created.
|
||||||
|
`.RunningFor` | Elapsed time since the container was started.
|
||||||
|
`.Ports` | Exposed ports.
|
||||||
|
`.Status` | Container status.
|
||||||
|
`.Size` | Container disk size.
|
||||||
|
`.Names` | Container names.
|
||||||
|
`.Labels` | All labels assigned to the container.
|
||||||
|
`.Label` | Value of a specific label for this container. For example `'{% raw %}{{.Label "com.docker.swarm.cpu"}}{% endraw %}'`
|
||||||
|
`.Mounts` | Names of the volumes mounted in this container.
|
||||||
|
`.Networks` | Names of the networks attached to this container.
|
||||||
|
|
||||||
|
When using the `--format` option, the `ps` command will either output the data
|
||||||
|
exactly as the template declares or, when using the `table` directive, includes
|
||||||
|
column headers as well.
|
||||||
|
|
||||||
|
The following example uses a template without headers and outputs the `ID` and
|
||||||
|
`Command` entries separated by a colon for all running containers:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{% raw %}
|
||||||
|
$ docker ps --format "{{.ID}}: {{.Command}}"
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
|
a87ecb4f327c: /bin/sh -c #(nop) MA
|
||||||
|
01946d9d34d8: /bin/sh -c #(nop) MA
|
||||||
|
c1d3b0166030: /bin/sh -c yum -y up
|
||||||
|
41d50ecd2f57: /bin/sh -c #(nop) MA
|
||||||
|
```
|
||||||
|
|
||||||
|
To list all running containers with their labels in a table format you can use:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{% raw %}
|
||||||
|
$ docker ps --format "table {{.ID}}\t{{.Labels}}"
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
|
CONTAINER ID LABELS
|
||||||
|
a87ecb4f327c com.docker.swarm.node=ubuntu,com.docker.swarm.storage=ssd
|
||||||
|
01946d9d34d8
|
||||||
|
c1d3b0166030 com.docker.swarm.node=debian,com.docker.swarm.cpu=6
|
||||||
|
41d50ecd2f57 com.docker.swarm.node=fedora,com.docker.swarm.cpu=3,com.docker.swarm.storage=ssd
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,30 @@
|
||||||
command: docker pull
|
command: docker pull
|
||||||
short: Pull an image or a repository from a registry
|
short: Pull an image or a repository from a registry
|
||||||
long: |
|
long: |-
|
||||||
Alias for `docker image pull`.
|
Most of your images will be created on top of a base image from the
|
||||||
|
[Docker Hub](https://hub.docker.com) registry.
|
||||||
|
|
||||||
|
[Docker Hub](https://hub.docker.com) contains many pre-built images that you
|
||||||
|
can `pull` and try without needing to define and configure your own.
|
||||||
|
|
||||||
|
To download a particular image, or set of images (i.e., a repository),
|
||||||
|
use `docker pull`.
|
||||||
|
|
||||||
|
### Proxy configuration
|
||||||
|
|
||||||
|
If you are behind an HTTP proxy server, for example in corporate settings,
|
||||||
|
before open a connect to registry, you may need to configure the Docker
|
||||||
|
daemon's proxy settings, using the `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY`
|
||||||
|
environment variables. To set these environment variables on a host using
|
||||||
|
`systemd`, refer to the [control and configure Docker with systemd](https://docs.docker.com/engine/admin/systemd/#http-proxy)
|
||||||
|
for variables configuration.
|
||||||
|
|
||||||
|
### Concurrent downloads
|
||||||
|
|
||||||
|
By default the Docker daemon will pull three layers of an image at a time.
|
||||||
|
If you are on a low bandwidth connection this may cause timeout issues and you may want to lower
|
||||||
|
this via the `--max-concurrent-downloads` daemon option. See the
|
||||||
|
[daemon documentation](dockerd.md) for more details.
|
||||||
usage: docker pull [OPTIONS] NAME[:TAG|@DIGEST]
|
usage: docker pull [OPTIONS] NAME[:TAG|@DIGEST]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -13,3 +36,202 @@ options:
|
||||||
- option: disable-content-trust
|
- option: disable-content-trust
|
||||||
default_value: "true"
|
default_value: "true"
|
||||||
description: Skip image verification
|
description: Skip image verification
|
||||||
|
example: |-
|
||||||
|
### Pull an image from Docker Hub
|
||||||
|
|
||||||
|
To download a particular image, or set of images (i.e., a repository), use
|
||||||
|
`docker pull`. If no tag is provided, Docker Engine uses the `:latest` tag as a
|
||||||
|
default. This command pulls the `debian:latest` image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker pull debian
|
||||||
|
|
||||||
|
Using default tag: latest
|
||||||
|
latest: Pulling from library/debian
|
||||||
|
fdd5d7827f33: Pull complete
|
||||||
|
a3ed95caeb02: Pull complete
|
||||||
|
Digest: sha256:e7d38b3517548a1c71e41bffe9c8ae6d6d29546ce46bf62159837aad072c90aa
|
||||||
|
Status: Downloaded newer image for debian:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
Docker images can consist of multiple layers. In the example above, the image
|
||||||
|
consists of two layers; `fdd5d7827f33` and `a3ed95caeb02`.
|
||||||
|
|
||||||
|
Layers can be reused by images. For example, the `debian:jessie` image shares
|
||||||
|
both layers with `debian:latest`. Pulling the `debian:jessie` image therefore
|
||||||
|
only pulls its metadata, but not its layers, because all layers are already
|
||||||
|
present locally:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker pull debian:jessie
|
||||||
|
|
||||||
|
jessie: Pulling from library/debian
|
||||||
|
fdd5d7827f33: Already exists
|
||||||
|
a3ed95caeb02: Already exists
|
||||||
|
Digest: sha256:a9c958be96d7d40df920e7041608f2f017af81800ca5ad23e327bc402626b58e
|
||||||
|
Status: Downloaded newer image for debian:jessie
|
||||||
|
```
|
||||||
|
|
||||||
|
To see which images are present locally, use the [`docker images`](images.md)
|
||||||
|
command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
debian jessie f50f9524513f 5 days ago 125.1 MB
|
||||||
|
debian latest f50f9524513f 5 days ago 125.1 MB
|
||||||
|
```
|
||||||
|
|
||||||
|
Docker uses a content-addressable image store, and the image ID is a SHA256
|
||||||
|
digest covering the image's configuration and layers. In the example above,
|
||||||
|
`debian:jessie` and `debian:latest` have the same image ID because they are
|
||||||
|
actually the *same* image tagged with different names. Because they are the
|
||||||
|
same image, their layers are stored only once and do not consume extra disk
|
||||||
|
space.
|
||||||
|
|
||||||
|
For more information about images, layers, and the content-addressable store,
|
||||||
|
refer to [understand images, containers, and storage drivers](https://docs.docker.com/engine/userguide/storagedriver/imagesandcontainers/).
|
||||||
|
|
||||||
|
|
||||||
|
### Pull an image by digest (immutable identifier)
|
||||||
|
|
||||||
|
So far, you've pulled images by their name (and "tag"). Using names and tags is
|
||||||
|
a convenient way to work with images. When using tags, you can `docker pull` an
|
||||||
|
image again to make sure you have the most up-to-date version of that image.
|
||||||
|
For example, `docker pull ubuntu:14.04` pulls the latest version of the Ubuntu
|
||||||
|
14.04 image.
|
||||||
|
|
||||||
|
In some cases you don't want images to be updated to newer versions, but prefer
|
||||||
|
to use a fixed version of an image. Docker enables you to pull an image by its
|
||||||
|
*digest*. When pulling an image by digest, you specify *exactly* which version
|
||||||
|
of an image to pull. Doing so, allows you to "pin" an image to that version,
|
||||||
|
and guarantee that the image you're using is always the same.
|
||||||
|
|
||||||
|
To know the digest of an image, pull the image first. Let's pull the latest
|
||||||
|
`ubuntu:14.04` image from Docker Hub:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker pull ubuntu:14.04
|
||||||
|
|
||||||
|
14.04: Pulling from library/ubuntu
|
||||||
|
5a132a7e7af1: Pull complete
|
||||||
|
fd2731e4c50c: Pull complete
|
||||||
|
28a2f68d1120: Pull complete
|
||||||
|
a3ed95caeb02: Pull complete
|
||||||
|
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
|
||||||
|
above, the digest of the image is:
|
||||||
|
|
||||||
|
sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker pull ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
|
||||||
|
|
||||||
|
sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2: Pulling from library/ubuntu
|
||||||
|
5a132a7e7af1: Already exists
|
||||||
|
fd2731e4c50c: Already exists
|
||||||
|
28a2f68d1120: Already exists
|
||||||
|
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:
|
||||||
|
|
||||||
|
```Dockerfile
|
||||||
|
FROM ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
|
||||||
|
MAINTAINER some maintainer <maintainer@example.com>
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Note**: Using this feature "pins" an image to a specific version in time.
|
||||||
|
> Docker will therefore not pull updated versions of an image, which may include
|
||||||
|
> security updates. If you want to pull an updated image, you need to change the
|
||||||
|
> digest accordingly.
|
||||||
|
|
||||||
|
|
||||||
|
### Pull from a different registry
|
||||||
|
|
||||||
|
By default, `docker pull` pulls images from [Docker Hub](https://hub.docker.com). It is also possible to
|
||||||
|
manually specify the path of a registry to pull from. For example, if you have
|
||||||
|
set up a local registry, you can specify its path to pull from it. A registry
|
||||||
|
path is similar to a URL, but does not contain a protocol specifier (`https://`).
|
||||||
|
|
||||||
|
The following command pulls the `testing/test-image` image from a local registry
|
||||||
|
listening on port 5000 (`myregistry.local:5000`):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker pull myregistry.local:5000/testing/test-image
|
||||||
|
```
|
||||||
|
|
||||||
|
Registry credentials are managed by [docker login](login.md).
|
||||||
|
|
||||||
|
Docker uses the `https://` protocol to communicate with a registry, unless the
|
||||||
|
registry is allowed to be accessed over an insecure connection. Refer to the
|
||||||
|
[insecure registries](dockerd.md#insecure-registries) section for more information.
|
||||||
|
|
||||||
|
|
||||||
|
### Pull a repository with multiple images
|
||||||
|
|
||||||
|
By default, `docker pull` pulls a *single* image from the registry. A repository
|
||||||
|
can contain multiple images. To pull all images from a repository, provide the
|
||||||
|
`-a` (or `--all-tags`) option when using `docker pull`.
|
||||||
|
|
||||||
|
This command pulls all images from the `fedora` repository:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker pull --all-tags fedora
|
||||||
|
|
||||||
|
Pulling repository fedora
|
||||||
|
ad57ef8d78d7: Download complete
|
||||||
|
105182bb5e8b: Download complete
|
||||||
|
511136ea3c5a: Download complete
|
||||||
|
73bd853d2ea5: Download complete
|
||||||
|
....
|
||||||
|
|
||||||
|
Status: Downloaded newer image for fedora
|
||||||
|
```
|
||||||
|
|
||||||
|
After the pull has completed use the `docker images` command to see the
|
||||||
|
images that were pulled. The example below shows all the `fedora` images
|
||||||
|
that are present locally:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images fedora
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
fedora rawhide ad57ef8d78d7 5 days ago 359.3 MB
|
||||||
|
fedora 20 105182bb5e8b 5 days ago 372.7 MB
|
||||||
|
fedora heisenbug 105182bb5e8b 5 days ago 372.7 MB
|
||||||
|
fedora latest 105182bb5e8b 5 days ago 372.7 MB
|
||||||
|
```
|
||||||
|
|
||||||
|
### Cancel a pull
|
||||||
|
|
||||||
|
Killing the `docker pull` process, for example by pressing `CTRL-c` while it is
|
||||||
|
running in a terminal, will terminate the pull operation.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker pull fedora
|
||||||
|
|
||||||
|
Using default tag: latest
|
||||||
|
latest: Pulling from library/fedora
|
||||||
|
a3ed95caeb02: Pulling fs layer
|
||||||
|
236608c7b546: Pulling fs layer
|
||||||
|
^C
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Note**: Technically, the Engine terminates a pull operation when the
|
||||||
|
> connection between the Docker Engine daemon and the Docker Engine client
|
||||||
|
> initiating the pull is lost. If the connection with the Engine daemon is
|
||||||
|
> lost for other reasons than a manual interaction, the pull is also aborted.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,23 @@
|
||||||
command: docker push
|
command: docker push
|
||||||
short: Push an image or a repository to a registry
|
short: Push an image or a repository to a registry
|
||||||
long: |
|
long: |-
|
||||||
Alias for `docker image push`.
|
Use `docker push` to share your images to the [Docker Hub](https://hub.docker.com)
|
||||||
|
registry or to a self-hosted one.
|
||||||
|
|
||||||
|
Refer to the [`docker tag`](tag.md) reference for more information about valid
|
||||||
|
image and tag names.
|
||||||
|
|
||||||
|
Killing the `docker push` process, for example by pressing `CTRL-c` while it is
|
||||||
|
running in a terminal, terminates the push operation.
|
||||||
|
|
||||||
|
Registry credentials are managed by [docker login](login.md).
|
||||||
|
|
||||||
|
### Concurrent uploads
|
||||||
|
|
||||||
|
By default the Docker daemon will push five layers of an image at a time.
|
||||||
|
If you are on a low bandwidth connection this may cause timeout issues and you may want to lower
|
||||||
|
this via the `--max-concurrent-uploads` daemon option. See the
|
||||||
|
[daemon documentation](dockerd.md) for more details.
|
||||||
usage: docker push [OPTIONS] NAME[:TAG]
|
usage: docker push [OPTIONS] NAME[:TAG]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -9,3 +25,34 @@ options:
|
||||||
- option: disable-content-trust
|
- option: disable-content-trust
|
||||||
default_value: "true"
|
default_value: "true"
|
||||||
description: Skip image signing
|
description: Skip image signing
|
||||||
|
example: |-
|
||||||
|
### Push a new image to a registry
|
||||||
|
|
||||||
|
First save the new image by finding the container ID (using [`docker ps`](ps.md))
|
||||||
|
and then committing it to a new image name. Note that only `a-z0-9-_.` are
|
||||||
|
allowed when naming images:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker commit c16378f943fe rhel-httpd
|
||||||
|
```
|
||||||
|
|
||||||
|
Now, push the image to the registry using the image ID. In this example the
|
||||||
|
registry is on host named `registry-host` and listening on port `5000`. To do
|
||||||
|
this, tag the image with the host name or IP address, and the port of the
|
||||||
|
registry:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker tag rhel-httpd registry-host:5000/myadmin/rhel-httpd
|
||||||
|
|
||||||
|
$ docker push registry-host:5000/myadmin/rhel-httpd
|
||||||
|
```
|
||||||
|
|
||||||
|
Check that this worked by running:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images
|
||||||
|
```
|
||||||
|
|
||||||
|
You should see both `rhel-httpd` and `registry-host:5000/myadmin/rhel-httpd`
|
||||||
|
listed.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
command: docker rename
|
command: docker rename
|
||||||
short: Rename a container
|
short: Rename a container
|
||||||
long: |
|
long: The `docker rename` command renames a container.
|
||||||
Alias for `docker container rename`.
|
|
||||||
usage: docker rename CONTAINER NEW_NAME
|
usage: docker rename CONTAINER NEW_NAME
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
example: |-
|
||||||
|
```bash
|
||||||
|
$ docker rename my_container my_new_container
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
command: docker restart
|
command: docker restart
|
||||||
short: Restart one or more containers
|
short: Restart one or more containers
|
||||||
long: |
|
long: Restart one or more containers
|
||||||
Alias for `docker container restart`.
|
|
||||||
usage: docker restart [OPTIONS] CONTAINER [CONTAINER...]
|
usage: docker restart [OPTIONS] CONTAINER [CONTAINER...]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -10,3 +9,8 @@ options:
|
||||||
shorthand: t
|
shorthand: t
|
||||||
default_value: "10"
|
default_value: "10"
|
||||||
description: Seconds to wait for stop before killing the container
|
description: Seconds to wait for stop before killing the container
|
||||||
|
example: |-
|
||||||
|
```bash
|
||||||
|
$ docker restart my_container
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
command: docker rm
|
command: docker rm
|
||||||
short: Remove one or more containers
|
short: Remove one or more containers
|
||||||
long: |
|
long: Remove one or more containers
|
||||||
Alias for `docker container rm`.
|
|
||||||
usage: docker rm [OPTIONS] CONTAINER [CONTAINER...]
|
usage: docker rm [OPTIONS] CONTAINER [CONTAINER...]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -18,3 +17,74 @@ options:
|
||||||
shorthand: v
|
shorthand: v
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Remove the volumes associated with the container
|
description: Remove the volumes associated with the container
|
||||||
|
example: |-
|
||||||
|
### Remove a container
|
||||||
|
|
||||||
|
This will remove the container referenced under the link
|
||||||
|
`/redis`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker rm /redis
|
||||||
|
|
||||||
|
/redis
|
||||||
|
```
|
||||||
|
|
||||||
|
### Remove a link specified with `--link` on the default bridge network
|
||||||
|
|
||||||
|
This will remove the underlying link between `/webapp` and the `/redis`
|
||||||
|
containers on the default bridge network, removing all network communication
|
||||||
|
between the two containers. This does not apply when `--link` is used with
|
||||||
|
user-specified networks.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker rm --link /webapp/redis
|
||||||
|
|
||||||
|
/webapp/redis
|
||||||
|
```
|
||||||
|
|
||||||
|
### Force-remove a running container
|
||||||
|
|
||||||
|
This command will force-remove a running container.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker rm --force redis
|
||||||
|
|
||||||
|
redis
|
||||||
|
```
|
||||||
|
|
||||||
|
The main process inside the container referenced under the link `redis` will receive
|
||||||
|
`SIGKILL`, then the container will be removed.
|
||||||
|
|
||||||
|
### Remove all stopped containers
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker rm $(docker ps -a -q)
|
||||||
|
```
|
||||||
|
|
||||||
|
This command will delete all stopped containers. The command
|
||||||
|
`docker ps -a -q` will return all existing container IDs and pass them to
|
||||||
|
the `rm` command which will delete them. Any running containers will not be
|
||||||
|
deleted.
|
||||||
|
|
||||||
|
### Remove a container and its volumes
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker rm -v redis
|
||||||
|
redis
|
||||||
|
```
|
||||||
|
|
||||||
|
This command will remove the container and any volumes associated with it.
|
||||||
|
Note that if a volume was specified with a name, it will not be removed.
|
||||||
|
|
||||||
|
### Remove a container and selectively remove volumes
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker create -v awesome:/foo -v /bar --name hello redis
|
||||||
|
hello
|
||||||
|
$ docker rm -v hello
|
||||||
|
```
|
||||||
|
|
||||||
|
In this example, the volume for `/foo` will remain intact, but the volume for
|
||||||
|
`/bar` will be removed. The same behavior holds for volumes inherited with
|
||||||
|
`--volumes-from`.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
command: docker rmi
|
command: docker rmi
|
||||||
short: Remove one or more images
|
short: Remove one or more images
|
||||||
long: |
|
long: Remove one or more images
|
||||||
Alias for `docker image rm`.
|
|
||||||
usage: docker rmi [OPTIONS] IMAGE [IMAGE...]
|
usage: docker rmi [OPTIONS] IMAGE [IMAGE...]
|
||||||
pname: docker
|
pname: docker
|
||||||
plink: docker.yaml
|
plink: docker.yaml
|
||||||
|
@ -13,3 +12,80 @@ options:
|
||||||
- option: no-prune
|
- option: no-prune
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Do not delete untagged parents
|
description: Do not delete untagged parents
|
||||||
|
example: |-
|
||||||
|
You can remove an image using its short or long ID, its tag, or its digest. If
|
||||||
|
an image has one or more tag referencing it, you must remove all of them before
|
||||||
|
the image is removed. Digest references are removed automatically when an image
|
||||||
|
is removed by tag.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
test1 latest fd484f19954f 23 seconds ago 7 B (virtual 4.964 MB)
|
||||||
|
test latest fd484f19954f 23 seconds ago 7 B (virtual 4.964 MB)
|
||||||
|
test2 latest fd484f19954f 23 seconds ago 7 B (virtual 4.964 MB)
|
||||||
|
|
||||||
|
$ docker rmi fd484f19954f
|
||||||
|
|
||||||
|
Error: Conflict, cannot delete image fd484f19954f because it is tagged in multiple repositories, use -f to force
|
||||||
|
2013/12/11 05:47:16 Error: failed to remove one or more images
|
||||||
|
|
||||||
|
$ docker rmi test1
|
||||||
|
|
||||||
|
Untagged: test1:latest
|
||||||
|
|
||||||
|
$ docker rmi test2
|
||||||
|
|
||||||
|
Untagged: test2:latest
|
||||||
|
|
||||||
|
|
||||||
|
$ docker images
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
test latest fd484f19954f 23 seconds ago 7 B (virtual 4.964 MB)
|
||||||
|
|
||||||
|
$ docker rmi test
|
||||||
|
|
||||||
|
Untagged: test:latest
|
||||||
|
Deleted: fd484f19954f4920da7ff372b5067f5b7ddb2fd3830cecd17b96ea9e286ba5b8
|
||||||
|
```
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
test1 latest fd484f19954f 23 seconds ago 7 B (virtual 4.964 MB)
|
||||||
|
test latest fd484f19954f 23 seconds ago 7 B (virtual 4.964 MB)
|
||||||
|
test2 latest fd484f19954f 23 seconds ago 7 B (virtual 4.964 MB)
|
||||||
|
|
||||||
|
$ docker rmi -f fd484f19954f
|
||||||
|
|
||||||
|
Untagged: test1:latest
|
||||||
|
Untagged: test:latest
|
||||||
|
Untagged: test2:latest
|
||||||
|
Deleted: fd484f19954f4920da7ff372b5067f5b7ddb2fd3830cecd17b96ea9e286ba5b8
|
||||||
|
```
|
||||||
|
|
||||||
|
An image pulled by digest has no tag associated with it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker images --digests
|
||||||
|
|
||||||
|
REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE
|
||||||
|
localhost:5000/test/busybox <none> sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf 4986bf8c1536 9 weeks ago 2.43 MB
|
||||||
|
```
|
||||||
|
|
||||||
|
To remove an image using its digest:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker rmi localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf
|
||||||
|
Untagged: localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf
|
||||||
|
Deleted: 4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125
|
||||||
|
Deleted: ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2
|
||||||
|
Deleted: df7546f9f060a2268024c8a230d8639878585defcc1bc6f79d2728a13957871b
|
||||||
|
```
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue