mirror of https://github.com/docker/cli.git
docs: update examples to not use deprecated images
using latest ubuntu LTS, and alpine for some examples. Also syncing some wording between the man-pages and online docs. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
74086bc93b
commit
9ba371f665
|
@ -50,8 +50,8 @@ created. Supported `Dockerfile` instructions:
|
||||||
$ docker ps
|
$ docker ps
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
|
c3f279d17e0a ubuntu:22.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
|
197387f1b436 ubuntu:22.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
|
||||||
|
|
||||||
$ docker commit c3f279d17e0a svendowideit/testimage:version3
|
$ docker commit c3f279d17e0a svendowideit/testimage:version3
|
||||||
|
|
||||||
|
@ -69,8 +69,8 @@ svendowideit/testimage version3 f5283438590d 16 sec
|
||||||
$ docker ps
|
$ docker ps
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
|
c3f279d17e0a ubuntu:22.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
|
197387f1b436 ubuntu:22.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
|
||||||
|
|
||||||
$ docker inspect -f "{{ .Config.Env }}" c3f279d17e0a
|
$ docker inspect -f "{{ .Config.Env }}" c3f279d17e0a
|
||||||
|
|
||||||
|
@ -91,8 +91,8 @@ $ docker inspect -f "{{ .Config.Env }}" f5283438590d
|
||||||
$ docker ps
|
$ docker ps
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
|
c3f279d17e0a ubuntu:22.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
|
197387f1b436 ubuntu:22.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
|
||||||
|
|
||||||
$ docker commit --change='CMD ["apachectl", "-DFOREGROUND"]' -c "EXPOSE 80" c3f279d17e0a svendowideit/testimage:version4
|
$ docker commit --change='CMD ["apachectl", "-DFOREGROUND"]' -c "EXPOSE 80" c3f279d17e0a svendowideit/testimage:version4
|
||||||
|
|
||||||
|
@ -106,6 +106,6 @@ $ docker ps
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
89373736e2e7 testimage:version4 "apachectl -DFOREGROU" 3 seconds ago Up 2 seconds 80/tcp distracted_fermat
|
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
|
c3f279d17e0a ubuntu:22.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
|
197387f1b436 ubuntu:22.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
|
||||||
```
|
```
|
||||||
|
|
|
@ -343,8 +343,8 @@ $ docker events --filter 'type=network'
|
||||||
|
|
||||||
$ docker events --filter 'container=container_1' --filter 'container=container_2'
|
$ 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-09-03T15:49:29.999999999Z07:00 container die 4386fb97867d (image=ubuntu:22.04)
|
||||||
2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04)
|
2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu:22.04)
|
||||||
2014-05-10T17:42:14.999999999Z07:00 container die 7805c1d35632 (imager=redis:2.8)
|
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)
|
2014-09-03T15:49:29.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ Running `docker ps --no-trunc` showing 2 linked containers.
|
||||||
$ docker ps --no-trunc
|
$ docker ps --no-trunc
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
4c01db0b339c ubuntu:12.04 bash 17 seconds ago Up 16 seconds 3300-3310/tcp webapp
|
4c01db0b339c ubuntu:22.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
|
d7886598dbe2 crosbymichael/redis:latest /redis-server --dir 33 minutes ago Up 33 minutes 6379/tcp redis,webapp/db
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -254,13 +254,13 @@ CONTAINER ID IMAGE COMMAND CREATED
|
||||||
919e1179bdb8 ubuntu-c1 "top" About a minute ago Up About a minute admiring_lovelace
|
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:
|
Match containers based on the `ubuntu` version `22.04` image:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker ps --filter ancestor=ubuntu:12.04.5
|
$ docker ps --filter ancestor=ubuntu:22.04
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
82a598284012 ubuntu:12.04.5 "top" 3 minutes ago Up 3 minutes sleepy_bose
|
82a598284012 ubuntu:22.04 "top" 3 minutes ago Up 3 minutes sleepy_bose
|
||||||
```
|
```
|
||||||
|
|
||||||
The following matches containers based on the layer `d0e008c6cf02` or an image
|
The following matches containers based on the layer `d0e008c6cf02` or an image
|
||||||
|
@ -270,7 +270,7 @@ that have this layer in its layer stack.
|
||||||
$ docker ps --filter ancestor=d0e008c6cf02
|
$ docker ps --filter ancestor=d0e008c6cf02
|
||||||
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
82a598284012 ubuntu:12.04.5 "top" 3 minutes ago Up 3 minutes sleepy_bose
|
82a598284012 ubuntu:22.04 "top" 3 minutes ago Up 3 minutes sleepy_bose
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Create time
|
#### Create time
|
||||||
|
|
|
@ -53,36 +53,36 @@ this via the `--max-concurrent-downloads` daemon option. See the
|
||||||
### Pull an image from Docker Hub
|
### Pull an image from Docker Hub
|
||||||
|
|
||||||
To download a particular image, or set of images (i.e., a repository), use
|
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
|
`docker image pull` (or the `docker pull` shorthand). If no tag is provided,
|
||||||
default. This command pulls the `debian:latest` image:
|
Docker Engine uses the `:latest` tag as a default. This example pulls the
|
||||||
|
`debian:latest` image:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker pull debian
|
$ docker image pull debian
|
||||||
|
|
||||||
Using default tag: latest
|
Using default tag: latest
|
||||||
latest: Pulling from library/debian
|
latest: Pulling from library/debian
|
||||||
fdd5d7827f33: Pull complete
|
e756f3fdd6a3: Pull complete
|
||||||
a3ed95caeb02: Pull complete
|
Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510
|
||||||
Digest: sha256:e7d38b3517548a1c71e41bffe9c8ae6d6d29546ce46bf62159837aad072c90aa
|
|
||||||
Status: Downloaded newer image for debian:latest
|
Status: Downloaded newer image for debian:latest
|
||||||
|
docker.io/library/debian:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
Docker images can consist of multiple layers. In the example above, the image
|
Docker images can consist of multiple layers. In the example above, the image
|
||||||
consists of two layers; `fdd5d7827f33` and `a3ed95caeb02`.
|
consists of a single layer; `e756f3fdd6a3`.
|
||||||
|
|
||||||
Layers can be reused by images. For example, the `debian:jessie` image shares
|
Layers can be reused by images. For example, the `debian:bullseye` image shares
|
||||||
both layers with `debian:latest`. Pulling the `debian:jessie` image therefore
|
its layer with the `debian:latest`. Pulling the `debian:bullseye` image therefore
|
||||||
only pulls its metadata, but not its layers, because all layers are already
|
only pulls its metadata, but not its layers, because the layer is already present
|
||||||
present locally:
|
locally:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker pull debian:jessie
|
$ docker image pull debian:bullseye
|
||||||
|
|
||||||
jessie: Pulling from library/debian
|
bullseye: Pulling from library/debian
|
||||||
fdd5d7827f33: Already exists
|
Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510
|
||||||
a3ed95caeb02: Already exists
|
Status: Downloaded newer image for debian:bullseye
|
||||||
Digest: sha256:a9c958be96d7d40df920e7041608f2f017af81800ca5ad23e327bc402626b58e
|
docker.io/library/debian:bullseye
|
||||||
Status: Downloaded newer image for debian:jessie
|
|
||||||
```
|
```
|
||||||
|
|
||||||
To see which images are present locally, use the [`docker images`](images.md)
|
To see which images are present locally, use the [`docker images`](images.md)
|
||||||
|
@ -91,17 +91,16 @@ command:
|
||||||
```console
|
```console
|
||||||
$ docker images
|
$ docker images
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
debian jessie f50f9524513f 5 days ago 125.1 MB
|
debian bullseye 4eacea30377a 8 days ago 124MB
|
||||||
debian latest f50f9524513f 5 days ago 125.1 MB
|
debian latest 4eacea30377a 8 days ago 124MB
|
||||||
```
|
```
|
||||||
|
|
||||||
Docker uses a content-addressable image store, and the image ID is a SHA256
|
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,
|
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
|
`debian:bullseye` and `debian:latest` have the same image ID because they are
|
||||||
actually the *same* image tagged with different names. Because they are the
|
the *same* image tagged with different names. Because they are the same image,
|
||||||
same image, their layers are stored only once and do not consume extra disk
|
their layers are stored only once and do not consume extra disk space.
|
||||||
space.
|
|
||||||
|
|
||||||
For more information about images, layers, and the content-addressable store,
|
For more information about images, layers, and the content-addressable store,
|
||||||
refer to [understand images, containers, and storage drivers](https://docs.docker.com/storage/storagedriver/).
|
refer to [understand images, containers, and storage drivers](https://docs.docker.com/storage/storagedriver/).
|
||||||
|
@ -112,8 +111,8 @@ refer to [understand images, containers, and storage drivers](https://docs.docke
|
||||||
So far, you've pulled images by their name (and "tag"). Using names and tags is
|
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
|
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.
|
image again to make sure you have the most up-to-date version of that image.
|
||||||
For example, `docker pull ubuntu:20.04` pulls the latest version of the Ubuntu
|
For example, `docker pull ubuntu:22.04` pulls the latest version of the Ubuntu
|
||||||
20.04 image.
|
22.04 image.
|
||||||
|
|
||||||
In some cases you don't want images to be updated to newer versions, but prefer
|
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
|
to use a fixed version of an image. Docker enables you to pull an image by its
|
||||||
|
@ -122,23 +121,23 @@ 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.
|
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
|
To know the digest of an image, pull the image first. Let's pull the latest
|
||||||
`ubuntu:20.04` image from Docker Hub:
|
`ubuntu:22.04` image from Docker Hub:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker pull ubuntu:20.04
|
$ docker pull ubuntu:22.04
|
||||||
|
|
||||||
20.04: Pulling from library/ubuntu
|
22.04: Pulling from library/ubuntu
|
||||||
16ec32c2132b: Pull complete
|
125a6e411906: Pull complete
|
||||||
Digest: sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
|
Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
|
||||||
Status: Downloaded newer image for ubuntu:20.04
|
Status: Downloaded newer image for ubuntu:22.04
|
||||||
docker.io/library/ubuntu:20.04
|
docker.io/library/ubuntu:22.04
|
||||||
```
|
```
|
||||||
|
|
||||||
Docker prints the digest of the image after the pull has finished. In the example
|
Docker prints the digest of the image after the pull has finished. In the example
|
||||||
above, the digest of the image is:
|
above, the digest of the image is:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
|
sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
|
||||||
```
|
```
|
||||||
|
|
||||||
Docker also prints the digest of an image when *pushing* to a registry. This
|
Docker also prints the digest of an image when *pushing* to a registry. This
|
||||||
|
@ -148,25 +147,25 @@ A digest takes the place of the tag when pulling an image, for example, to
|
||||||
pull the above image by digest, run the following command:
|
pull the above image by digest, run the following command:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker pull ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
|
$ docker pull ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
|
||||||
|
|
||||||
docker.io/library/ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3: Pulling from library/ubuntu
|
docker.io/library/ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d: Pulling from library/ubuntu
|
||||||
Digest: sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
|
Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
|
||||||
Status: Image is up to date for ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
|
Status: Image is up to date for ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
|
||||||
docker.io/library/ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
|
docker.io/library/ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
|
||||||
```
|
```
|
||||||
|
|
||||||
Digest can also be used in the `FROM` of a Dockerfile, for example:
|
Digest can also be used in the `FROM` of a Dockerfile, for example:
|
||||||
|
|
||||||
```dockerfile
|
```dockerfile
|
||||||
FROM ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
|
FROM ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
|
||||||
LABEL org.opencontainers.image.authors="some maintainer <maintainer@example.com>"
|
LABEL org.opencontainers.image.authors="some maintainer <maintainer@example.com>"
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
> Using this feature "pins" an image to a specific version in time.
|
> 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
|
> Docker does 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
|
> security updates. If you want to pull an updated image, you need to change the
|
||||||
> digest accordingly.
|
> digest accordingly.
|
||||||
|
|
||||||
|
@ -182,7 +181,7 @@ The following command pulls the `testing/test-image` image from a local registry
|
||||||
listening on port 5000 (`myregistry.local:5000`):
|
listening on port 5000 (`myregistry.local:5000`):
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker pull myregistry.local:5000/testing/test-image
|
$ docker image pull myregistry.local:5000/testing/test-image
|
||||||
```
|
```
|
||||||
|
|
||||||
Registry credentials are managed by [docker login](login.md).
|
Registry credentials are managed by [docker login](login.md).
|
||||||
|
@ -198,33 +197,35 @@ 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
|
can contain multiple images. To pull all images from a repository, provide the
|
||||||
`-a` (or `--all-tags`) option when using `docker pull`.
|
`-a` (or `--all-tags`) option when using `docker pull`.
|
||||||
|
|
||||||
This command pulls all images from the `fedora` repository:
|
This command pulls all images from the `ubuntu` repository:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker pull --all-tags fedora
|
$ docker image pull --all-tags ubuntu
|
||||||
|
|
||||||
Pulling repository fedora
|
Pulling repository ubuntu
|
||||||
ad57ef8d78d7: Download complete
|
ad57ef8d78d7: Download complete
|
||||||
105182bb5e8b: Download complete
|
105182bb5e8b: Download complete
|
||||||
511136ea3c5a: Download complete
|
511136ea3c5a: Download complete
|
||||||
73bd853d2ea5: Download complete
|
73bd853d2ea5: Download complete
|
||||||
....
|
....
|
||||||
|
|
||||||
Status: Downloaded newer image for fedora
|
Status: Downloaded newer image for ubuntu
|
||||||
```
|
```
|
||||||
|
|
||||||
After the pull has completed use the `docker images` command to see the
|
After the pull has completed use the `docker image ls` command (or the `docker images`
|
||||||
images that were pulled. The example below shows all the `fedora` images
|
shorthand) to see the images that were pulled. The example below shows all the
|
||||||
that are present locally:
|
`ubuntu` images that are present locally:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker images fedora
|
$ docker image ls --filter reference=ubuntu
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
ubuntu 18.04 c6ad7e71ba7d 5 weeks ago 63.2MB
|
||||||
fedora rawhide ad57ef8d78d7 5 days ago 359.3 MB
|
ubuntu bionic c6ad7e71ba7d 5 weeks ago 63.2MB
|
||||||
fedora 20 105182bb5e8b 5 days ago 372.7 MB
|
ubuntu 22.04 5ccefbfc0416 2 months ago 78MB
|
||||||
fedora heisenbug 105182bb5e8b 5 days ago 372.7 MB
|
ubuntu focal ff0fea8310f3 2 months ago 72.8MB
|
||||||
fedora latest 105182bb5e8b 5 days ago 372.7 MB
|
ubuntu latest ff0fea8310f3 2 months ago 72.8MB
|
||||||
|
ubuntu jammy 41ba606c8ab9 3 months ago 79MB
|
||||||
|
ubuntu 20.04 ba6acccedd29 7 months ago 72.8MB
|
||||||
```
|
```
|
||||||
|
|
||||||
### Cancel a pull
|
### Cancel a pull
|
||||||
|
@ -233,18 +234,15 @@ Killing the `docker pull` process, for example by pressing `CTRL-c` while it is
|
||||||
running in a terminal, will terminate the pull operation.
|
running in a terminal, will terminate the pull operation.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker pull fedora
|
$ docker pull ubuntu
|
||||||
|
|
||||||
Using default tag: latest
|
Using default tag: latest
|
||||||
latest: Pulling from library/fedora
|
latest: Pulling from library/ubuntu
|
||||||
a3ed95caeb02: Pulling fs layer
|
a3ed95caeb02: Pulling fs layer
|
||||||
236608c7b546: Pulling fs layer
|
236608c7b546: Pulling fs layer
|
||||||
^C
|
^C
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Note**
|
The Engine terminates a pull operation when the connection between the daemon
|
||||||
>
|
and the client (initiating the pull) is cut or lost for any reason or the
|
||||||
> The Engine terminates a pull operation when the connection between the Docker
|
command is manually terminated.
|
||||||
> 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.
|
|
||||||
|
|
|
@ -678,7 +678,7 @@ follows:
|
||||||
| `node.platform.os` | Node operating system | `node.platform.os==windows` |
|
| `node.platform.os` | Node operating system | `node.platform.os==windows` |
|
||||||
| `node.platform.arch` | Node architecture | `node.platform.arch==x86_64` |
|
| `node.platform.arch` | Node architecture | `node.platform.arch==x86_64` |
|
||||||
| `node.labels` | User-defined node labels | `node.labels.security==high` |
|
| `node.labels` | User-defined node labels | `node.labels.security==high` |
|
||||||
| `engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-14.04` |
|
| `engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-22.04` |
|
||||||
|
|
||||||
`engine.labels` apply to Docker Engine labels like operating system, drivers,
|
`engine.labels` apply to Docker Engine labels like operating system, drivers,
|
||||||
etc. Swarm administrators add `node.labels` for operational purposes by using
|
etc. Swarm administrators add `node.labels` for operational purposes by using
|
||||||
|
|
|
@ -281,8 +281,8 @@ $ docker system events --filter 'type=network'
|
||||||
|
|
||||||
$ docker system events --filter 'container=container_1' --filter 'container=container_2'
|
$ docker system 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-09-03T15:49:29.999999999Z07:00 container die 4386fb97867d (image=ubuntu:22.04 )
|
||||||
2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04)
|
2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu:22.04 )
|
||||||
2014-05-10T17:42:14.999999999Z07:00 container die 7805c1d35632 (imager=redis:2.8)
|
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)
|
2014-09-03T15:49:29.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,7 @@ PID files):
|
||||||
|
|
||||||
While not strictly a means of identifying a container, you can specify a version of an
|
While not strictly a means of identifying a container, you can specify a version of an
|
||||||
image you'd like to run the container with by adding `image[:tag]` to the command. For
|
image you'd like to run the container with by adding `image[:tag]` to the command. For
|
||||||
example, `docker run ubuntu:14.04`.
|
example, `docker run ubuntu:22.04`.
|
||||||
|
|
||||||
### Image[@digest]
|
### Image[@digest]
|
||||||
|
|
||||||
|
@ -837,14 +837,14 @@ We have four ways to set user memory usage:
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -it ubuntu:14.04 /bin/bash
|
$ docker run -it ubuntu:22.04 /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
We set nothing about memory, this means the processes in the container can use
|
We set nothing about memory, this means the processes in the container can use
|
||||||
as much memory and swap memory as they need.
|
as much memory and swap memory as they need.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -it -m 300M --memory-swap -1 ubuntu:14.04 /bin/bash
|
$ docker run -it -m 300M --memory-swap -1 ubuntu:22.04 /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
We set memory limit and disabled swap memory limit, this means the processes in
|
We set memory limit and disabled swap memory limit, this means the processes in
|
||||||
|
@ -852,7 +852,7 @@ the container can use 300M memory and as much swap memory as they need (if the
|
||||||
host supports swap memory).
|
host supports swap memory).
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -it -m 300M ubuntu:14.04 /bin/bash
|
$ docker run -it -m 300M ubuntu:22.04 /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
We set memory limit only, this means the processes in the container can use
|
We set memory limit only, this means the processes in the container can use
|
||||||
|
@ -861,7 +861,7 @@ We set memory limit only, this means the processes in the container can use
|
||||||
would be 2*300M, so processes can use 300M swap memory as well.
|
would be 2*300M, so processes can use 300M swap memory as well.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -it -m 300M --memory-swap 1G ubuntu:14.04 /bin/bash
|
$ docker run -it -m 300M --memory-swap 1G ubuntu:22.04 /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
We set both memory and swap memory, so the processes in the container can use
|
We set both memory and swap memory, so the processes in the container can use
|
||||||
|
@ -887,7 +887,7 @@ The following example limits the memory (`-m`) to 500M and sets the memory
|
||||||
reservation to 200M.
|
reservation to 200M.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -it -m 500M --memory-reservation 200M ubuntu:14.04 /bin/bash
|
$ docker run -it -m 500M --memory-reservation 200M ubuntu:22.04 /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
Under this configuration, when the container consumes memory more than 200M and
|
Under this configuration, when the container consumes memory more than 200M and
|
||||||
|
@ -897,7 +897,7 @@ memory below 200M.
|
||||||
The following example set memory reservation to 1G without a hard memory limit.
|
The following example set memory reservation to 1G without a hard memory limit.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -it --memory-reservation 1G ubuntu:14.04 /bin/bash
|
$ docker run -it --memory-reservation 1G ubuntu:22.04 /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
The container can use as much memory as it needs. The memory reservation setting
|
The container can use as much memory as it needs. The memory reservation setting
|
||||||
|
@ -915,13 +915,13 @@ The following example limits the memory to 100M and disables the OOM killer for
|
||||||
this container:
|
this container:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -it -m 100M --oom-kill-disable ubuntu:14.04 /bin/bash
|
$ docker run -it -m 100M --oom-kill-disable ubuntu:22.04 /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
The following example, illustrates a dangerous way to use the flag:
|
The following example, illustrates a dangerous way to use the flag:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -it --oom-kill-disable ubuntu:14.04 /bin/bash
|
$ docker run -it --oom-kill-disable ubuntu:22.04 /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
The container has unlimited memory which can cause the host to run out memory
|
The container has unlimited memory which can cause the host to run out memory
|
||||||
|
@ -991,14 +991,14 @@ limit and "K" the kernel limit. There are three possible ways to set limits:
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -it -m 500M --kernel-memory 50M ubuntu:14.04 /bin/bash
|
$ docker run -it -m 500M --kernel-memory 50M ubuntu:22.04 /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
We set memory and kernel memory, so the processes in the container can use
|
We set memory and kernel memory, so the processes in the container can use
|
||||||
500M memory in total, in this 500M memory, it can be 50M kernel memory tops.
|
500M memory in total, in this 500M memory, it can be 50M kernel memory tops.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -it --kernel-memory 50M ubuntu:14.04 /bin/bash
|
$ docker run -it --kernel-memory 50M ubuntu:22.04 /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
We set kernel memory without **-m**, so the processes in the container can
|
We set kernel memory without **-m**, so the processes in the container can
|
||||||
|
@ -1015,7 +1015,7 @@ between 0 and 100. A value of 0 turns off anonymous page swapping. A value of
|
||||||
For example, you can set:
|
For example, you can set:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -it --memory-swappiness=0 ubuntu:14.04 /bin/bash
|
$ docker run -it --memory-swappiness=0 ubuntu:22.04 /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
Setting the `--memory-swappiness` option is helpful when you want to retain the
|
Setting the `--memory-swappiness` option is helpful when you want to retain the
|
||||||
|
@ -1066,7 +1066,7 @@ And usually `--cpu-period` should work with `--cpu-quota`.
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -it --cpu-period=50000 --cpu-quota=25000 ubuntu:14.04 /bin/bash
|
$ docker run -it --cpu-period=50000 --cpu-quota=25000 ubuntu:22.04 /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
If there is 1 CPU, this means the container can get 50% CPU worth of run-time every 50ms.
|
If there is 1 CPU, this means the container can get 50% CPU worth of run-time every 50ms.
|
||||||
|
@ -1087,13 +1087,13 @@ We can set cpus in which to allow execution for containers.
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -it --cpuset-cpus="1,3" ubuntu:14.04 /bin/bash
|
$ docker run -it --cpuset-cpus="1,3" ubuntu:22.04 /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
This means processes in container can be executed on cpu 1 and cpu 3.
|
This means processes in container can be executed on cpu 1 and cpu 3.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -it --cpuset-cpus="0-2" ubuntu:14.04 /bin/bash
|
$ docker run -it --cpuset-cpus="0-2" ubuntu:22.04 /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
This means processes in container can be executed on cpu 0, cpu 1 and cpu 2.
|
This means processes in container can be executed on cpu 0, cpu 1 and cpu 2.
|
||||||
|
@ -1104,14 +1104,14 @@ on NUMA systems.
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -it --cpuset-mems="1,3" ubuntu:14.04 /bin/bash
|
$ docker run -it --cpuset-mems="1,3" ubuntu:22.04 /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
This example restricts the processes in the container to only use memory from
|
This example restricts the processes in the container to only use memory from
|
||||||
memory nodes 1 and 3.
|
memory nodes 1 and 3.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -it --cpuset-mems="0-2" ubuntu:14.04 /bin/bash
|
$ docker run -it --cpuset-mems="0-2" ubuntu:22.04 /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
This example restricts the processes in the container to only use memory from
|
This example restricts the processes in the container to only use memory from
|
||||||
|
@ -1143,8 +1143,8 @@ For example, the commands below create two containers with different blkio
|
||||||
weight:
|
weight:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -it --name c1 --blkio-weight 300 ubuntu:14.04 /bin/bash
|
$ docker run -it --name c1 --blkio-weight 300 ubuntu:22.04 /bin/bash
|
||||||
$ docker run -it --name c2 --blkio-weight 600 ubuntu:14.04 /bin/bash
|
$ docker run -it --name c2 --blkio-weight 600 ubuntu:22.04 /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
If you do block IO in the two containers at the same time, by, for example:
|
If you do block IO in the two containers at the same time, by, for example:
|
||||||
|
@ -1359,11 +1359,11 @@ For interacting with the network stack, instead of using `--privileged` they
|
||||||
should use `--cap-add=NET_ADMIN` to modify the network interfaces.
|
should use `--cap-add=NET_ADMIN` to modify the network interfaces.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -it --rm ubuntu:14.04 ip link add dummy0 type dummy
|
$ docker run -it --rm ubuntu:22.04 ip link add dummy0 type dummy
|
||||||
|
|
||||||
RTNETLINK answers: Operation not permitted
|
RTNETLINK answers: Operation not permitted
|
||||||
|
|
||||||
$ docker run -it --rm --cap-add=NET_ADMIN ubuntu:14.04 ip link add dummy0 type dummy
|
$ docker run -it --rm --cap-add=NET_ADMIN ubuntu:22.04 ip link add dummy0 type dummy
|
||||||
```
|
```
|
||||||
|
|
||||||
To mount a FUSE based filesystem, you need to combine both `--cap-add` and
|
To mount a FUSE based filesystem, you need to combine both `--cap-add` and
|
||||||
|
|
|
@ -48,10 +48,10 @@ Valid placeholders for the Go template are listed below:
|
||||||
|
|
||||||
$ docker container ls -a
|
$ docker container ls -a
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
a87ecb4f327c fedora:20 /bin/sh -c #(nop) MA 20 minutes ago Exit 0 desperate_brattain
|
a87ecb4f327c ubuntu:22.04 /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
|
01946d9d34d8 busybox /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
|
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
|
41d50ecd2f57 ubuntu:22.04 /bin/sh -c #(nop) MA 2 weeks ago Exit 0 drunk_pike
|
||||||
|
|
||||||
## Display only IDs of all containers, including non-running
|
## Display only IDs of all containers, including non-running
|
||||||
|
|
||||||
|
@ -87,10 +87,10 @@ Valid placeholders for the Go template are listed below:
|
||||||
|
|
||||||
$ docker container ls --format 'table {{.ID}}\t{{(.Label "com.docker.swarm.node")}}'
|
$ docker container ls --format 'table {{.ID}}\t{{(.Label "com.docker.swarm.node")}}'
|
||||||
CONTAINER ID NODE
|
CONTAINER ID NODE
|
||||||
a87ecb4f327c ubuntu
|
a87ecb4f327c worker-1
|
||||||
01946d9d34d8
|
01946d9d34d8
|
||||||
c1d3b0166030 debian
|
c1d3b0166030 worker-1
|
||||||
41d50ecd2f57 fedora
|
41d50ecd2f57 worker-2
|
||||||
|
|
||||||
## Display containers with `remote-volume` mounted
|
## Display containers with `remote-volume` mounted
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ The title REPOSITORY for the first title may seem confusing. It is essentially
|
||||||
the image name. However, because you can tag a specific image, and multiple tags
|
the image name. However, because you can tag a specific image, and multiple tags
|
||||||
(image instances) can be associated with a single name, the name is really a
|
(image instances) can be associated with a single name, the name is really a
|
||||||
repository for all tagged images of the same name. For example consider an image
|
repository for all tagged images of the same name. For example consider an image
|
||||||
called fedora. It may be tagged with 18, 19, or 20, etc. to manage different
|
called ubuntu. It may be tagged with 20.04 or 22.04, etc. to manage different
|
||||||
versions.
|
versions.
|
||||||
|
|
||||||
## Filters
|
## Filters
|
||||||
|
|
|
@ -11,52 +11,51 @@ registry located at `registry-1.docker.io` by default.
|
||||||
### Pull an image from Docker Hub
|
### Pull an image from Docker Hub
|
||||||
|
|
||||||
To download a particular image, or set of images (i.e., a repository), use
|
To download a particular image, or set of images (i.e., a repository), use
|
||||||
`docker image pull`. If no tag is provided, Docker Engine uses the `:latest` tag as a
|
`docker image pull` (or the `docker pull` shorthand). If no tag is provided,
|
||||||
default. This command pulls the `debian:latest` image:
|
Docker Engine uses the `:latest` tag as a default. This example pulls the
|
||||||
|
`debian:latest` image:
|
||||||
|
|
||||||
$ docker image pull debian
|
$ docker image pull debian
|
||||||
|
|
||||||
Using default tag: latest
|
Using default tag: latest
|
||||||
latest: Pulling from library/debian
|
latest: Pulling from library/debian
|
||||||
fdd5d7827f33: Pull complete
|
e756f3fdd6a3: Pull complete
|
||||||
a3ed95caeb02: Pull complete
|
Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510
|
||||||
Digest: sha256:e7d38b3517548a1c71e41bffe9c8ae6d6d29546ce46bf62159837aad072c90aa
|
|
||||||
Status: Downloaded newer image for debian:latest
|
Status: Downloaded newer image for debian:latest
|
||||||
|
docker.io/library/debian:latest
|
||||||
|
|
||||||
Docker images can consist of multiple layers. In the example above, the image
|
Docker images can consist of multiple layers. In the example above, the image
|
||||||
consists of two layers; `fdd5d7827f33` and `a3ed95caeb02`.
|
consists of a single layer; `e756f3fdd6a3`.
|
||||||
|
|
||||||
Layers can be reused by images. For example, the `debian:jessie` image shares
|
Layers can be reused by images. For example, the `debian:bullseye` image shares
|
||||||
both layers with `debian:latest`. Pulling the `debian:jessie` image therefore
|
its layer with the `debian:latest`. Pulling the `debian:bullseye` image therefore
|
||||||
only pulls its metadata, but not its layers, because all layers are already
|
only pulls its metadata, but not its layers, because the layer is already present
|
||||||
present locally:
|
locally:
|
||||||
|
|
||||||
$ docker image pull debian:jessie
|
$ docker image pull debian:bullseye
|
||||||
|
|
||||||
jessie: Pulling from library/debian
|
bullseye: Pulling from library/debian
|
||||||
fdd5d7827f33: Already exists
|
Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510
|
||||||
a3ed95caeb02: Already exists
|
Status: Downloaded newer image for debian:bullseye
|
||||||
Digest: sha256:a9c958be96d7d40df920e7041608f2f017af81800ca5ad23e327bc402626b58e
|
docker.io/library/debian:bullseye
|
||||||
Status: Downloaded newer image for debian:jessie
|
|
||||||
|
|
||||||
To see which images are present locally, use the **docker-images(1)**
|
To see which images are present locally, use the **docker-images(1)**
|
||||||
command:
|
command:
|
||||||
|
|
||||||
$ docker images
|
$ docker images
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
debian jessie f50f9524513f 5 days ago 125.1 MB
|
debian bullseye 4eacea30377a 8 days ago 124MB
|
||||||
debian latest f50f9524513f 5 days ago 125.1 MB
|
debian latest 4eacea30377a 8 days ago 124MB
|
||||||
|
|
||||||
Docker uses a content-addressable image store, and the image ID is a SHA256
|
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,
|
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
|
`debian:bullseye` and `debian:latest` have the same image ID because they are
|
||||||
actually the *same* image tagged with different names. Because they are the
|
the *same* image tagged with different names. Because they are the same image,
|
||||||
same image, their layers are stored only once and do not consume extra disk
|
their layers are stored only once and do not consume extra disk space.
|
||||||
space.
|
|
||||||
|
|
||||||
For more information about images, layers, and the content-addressable store,
|
For more information about images, layers, and the content-addressable store,
|
||||||
refer to [about storage drivers](https://docs.docker.com/storage/storagedriver/)
|
refer to [understand images, containers, and storage drivers](https://docs.docker.com/storage/storagedriver/)
|
||||||
in the online documentation.
|
in the online documentation.
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,8 +64,8 @@ in the online documentation.
|
||||||
So far, you've pulled images by their name (and "tag"). Using names and tags is
|
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 image pull` an
|
a convenient way to work with images. When using tags, you can `docker image pull` an
|
||||||
image again to make sure you have the most up-to-date version of that image.
|
image again to make sure you have the most up-to-date version of that image.
|
||||||
For example, `docker image pull ubuntu:14.04` pulls the latest version of the Ubuntu
|
For example, `docker image pull ubuntu:22.04` pulls the latest version of the Ubuntu
|
||||||
14.04 image.
|
22.04 image.
|
||||||
|
|
||||||
In some cases you don't want images to be updated to newer versions, but prefer
|
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
|
to use a fixed version of an image. Docker enables you to pull an image by its
|
||||||
|
@ -75,50 +74,47 @@ 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.
|
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
|
To know the digest of an image, pull the image first. Let's pull the latest
|
||||||
`ubuntu:14.04` image from Docker Hub:
|
`ubuntu:22.04` image from Docker Hub:
|
||||||
|
|
||||||
$ docker image pull ubuntu:14.04
|
$ docker image pull ubuntu:22.04
|
||||||
|
|
||||||
14.04: Pulling from library/ubuntu
|
22.04: Pulling from library/ubuntu
|
||||||
5a132a7e7af1: Pull complete
|
125a6e411906: Pull complete
|
||||||
fd2731e4c50c: Pull complete
|
Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
|
||||||
28a2f68d1120: Pull complete
|
Status: Downloaded newer image for ubuntu:22.04
|
||||||
a3ed95caeb02: Pull complete
|
docker.io/library/ubuntu:22.04
|
||||||
Digest: sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
|
|
||||||
Status: Downloaded newer image for ubuntu:14.04
|
|
||||||
|
|
||||||
Docker prints the digest of the image after the pull has finished. In the example
|
Docker prints the digest of the image after the pull has finished. In the example
|
||||||
above, the digest of the image is:
|
above, the digest of the image is:
|
||||||
|
|
||||||
sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
|
sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
|
||||||
|
|
||||||
Docker also prints the digest of an image when *pushing* to a registry. This
|
Docker also prints the digest of an image when *pushing* to a registry. This
|
||||||
may be useful if you want to pin to a version of the image you just pushed.
|
may be useful if you want to pin to a version of the image you just pushed.
|
||||||
|
|
||||||
A digest takes the place of the tag when pulling an image, for example, to
|
A digest takes the place of the tag when pulling an image, for example, to
|
||||||
pull the above image by digest, run the following command:
|
pull the above image by digest, run the following command:
|
||||||
|
|
||||||
$ docker image pull ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
|
$ docker image pull ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
|
||||||
|
|
||||||
sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2: Pulling from library/ubuntu
|
docker.io/library/ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d: Pulling from library/ubuntu
|
||||||
5a132a7e7af1: Already exists
|
Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
|
||||||
fd2731e4c50c: Already exists
|
Status: Image is up to date for ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
|
||||||
28a2f68d1120: Already exists
|
docker.io/library/ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
|
||||||
a3ed95caeb02: Already exists
|
|
||||||
Digest: sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
|
|
||||||
Status: Downloaded newer image for ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
|
|
||||||
|
|
||||||
Digest can also be used in the `FROM` of a Dockerfile, for example:
|
Digest can also be used in the `FROM` of a Dockerfile, for example:
|
||||||
|
|
||||||
FROM ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
|
FROM ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
|
||||||
LABEL org.opencontainers.image.authors="some maintainer <maintainer@example.com>"
|
LABEL org.opencontainers.image.authors="some maintainer <maintainer@example.com>"
|
||||||
|
|
||||||
> **Note**: Using this feature "pins" an image to a specific version in time.
|
> **Note**
|
||||||
> Docker will therefore not pull updated versions of an image, which may include
|
>
|
||||||
|
> Using this feature "pins" an image to a specific version in time.
|
||||||
|
> Docker does 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
|
> security updates. If you want to pull an updated image, you need to change the
|
||||||
> digest accordingly.
|
> digest accordingly.
|
||||||
|
|
||||||
## Pulling from a different registry
|
## Pull from a different registry
|
||||||
|
|
||||||
By default, `docker image pull` pulls images from Docker Hub. It is also possible to
|
By default, `docker image pull` pulls images from Docker Hub. It is also possible to
|
||||||
manually specify the path of a registry to pull from. For example, if you have
|
manually specify the path of a registry to pull from. For example, if you have
|
||||||
|
@ -144,46 +140,48 @@ By default, `docker image pull` pulls a *single* image from the registry. A repo
|
||||||
can contain multiple images. To pull all images from a repository, provide the
|
can contain multiple images. To pull all images from a repository, provide the
|
||||||
`-a` (or `--all-tags`) option when using `docker image pull`.
|
`-a` (or `--all-tags`) option when using `docker image pull`.
|
||||||
|
|
||||||
This command pulls all images from the `fedora` repository:
|
This command pulls all images from the `ubuntu` repository:
|
||||||
|
|
||||||
$ docker image pull --all-tags fedora
|
$ docker image pull --all-tags ubuntu
|
||||||
|
|
||||||
Pulling repository fedora
|
Pulling repository ubuntu
|
||||||
ad57ef8d78d7: Download complete
|
ad57ef8d78d7: Download complete
|
||||||
105182bb5e8b: Download complete
|
105182bb5e8b: Download complete
|
||||||
511136ea3c5a: Download complete
|
511136ea3c5a: Download complete
|
||||||
73bd853d2ea5: Download complete
|
73bd853d2ea5: Download complete
|
||||||
....
|
....
|
||||||
|
|
||||||
Status: Downloaded newer image for fedora
|
Status: Downloaded newer image for ubuntu
|
||||||
|
|
||||||
After the pull has completed use the `docker images` command to see the
|
After the pull has completed use the `docker image ls` (or `docker images` shorthand)
|
||||||
images that were pulled. The example below shows all the `fedora` images
|
command to see the images that were pulled. The example below shows all the `ubuntu`
|
||||||
that are present locally:
|
images that are present locally:
|
||||||
|
|
||||||
$ docker images fedora
|
$ docker image ls --filter reference=ubuntu
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
ubuntu 18.04 c6ad7e71ba7d 5 weeks ago 63.2MB
|
||||||
|
ubuntu bionic c6ad7e71ba7d 5 weeks ago 63.2MB
|
||||||
|
ubuntu 22.04 5ccefbfc0416 2 months ago 78MB
|
||||||
|
ubuntu focal ff0fea8310f3 2 months ago 72.8MB
|
||||||
|
ubuntu latest ff0fea8310f3 2 months ago 72.8MB
|
||||||
|
ubuntu jammy 41ba606c8ab9 3 months ago 79MB
|
||||||
|
ubuntu 20.04 ba6acccedd29 7 months ago 72.8MB
|
||||||
|
...
|
||||||
|
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
## Cancel a pull
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
## Canceling a pull
|
|
||||||
|
|
||||||
Killing the `docker image pull` process, for example by pressing `CTRL-c` while it is
|
Killing the `docker image pull` process, for example by pressing `CTRL-c` while it is
|
||||||
running in a terminal, will terminate the pull operation.
|
running in a terminal, will terminate the pull operation.
|
||||||
|
|
||||||
$ docker image pull fedora
|
$ docker image pull ubuntu
|
||||||
|
|
||||||
Using default tag: latest
|
Using default tag: latest
|
||||||
latest: Pulling from library/fedora
|
latest: Pulling from library/ubuntu
|
||||||
a3ed95caeb02: Pulling fs layer
|
a3ed95caeb02: Pulling fs layer
|
||||||
236608c7b546: Pulling fs layer
|
236608c7b546: Pulling fs layer
|
||||||
^C
|
^C
|
||||||
|
|
||||||
> **Note**: Technically, the Engine terminates a pull operation when the
|
The Engine terminates a pull operation when the connection between the Docker
|
||||||
> connection between the Docker Engine daemon and the Docker Engine client
|
Engine daemon and the Docker Engine client initiating the pull is lost. If the
|
||||||
> initiating the pull is lost. If the connection with the Engine daemon is
|
connection with the Engine daemon is lost for other reasons than a manual
|
||||||
> lost for other reasons than a manual interaction, the pull is also aborted.
|
interaction, the pull is also aborted.
|
||||||
|
|
|
@ -62,8 +62,8 @@ The following example outputs all events that were generated in the last 3 minut
|
||||||
relative to the current time on the client machine:
|
relative to the current time on the client machine:
|
||||||
|
|
||||||
# docker events --since '3m'
|
# docker events --since '3m'
|
||||||
2015-05-12T11:51:30.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) die
|
2015-05-12T11:51:30.999999999Z07:00 4386fb97867d: (from ubuntu:22.04) die
|
||||||
2015-05-12T15:52:12.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) stop
|
2015-05-12T15:52:12.999999999Z07:00 4386fb97867d: (from ubuntu:22.04) stop
|
||||||
2015-05-12T15:53:45.999999999Z07:00 7805c1d35632: (from redis:2.8) die
|
2015-05-12T15:53:45.999999999Z07:00 7805c1d35632: (from redis:2.8) die
|
||||||
2015-05-12T15:54:03.999999999Z07:00 7805c1d35632: (from redis:2.8) stop
|
2015-05-12T15:54:03.999999999Z07:00 7805c1d35632: (from redis:2.8) stop
|
||||||
|
|
||||||
|
@ -97,21 +97,21 @@ Lines. For information about JSON Lines, please refer to http://jsonlines.org/ .
|
||||||
## Filters
|
## Filters
|
||||||
|
|
||||||
$ docker events --filter 'event=stop'
|
$ docker events --filter 'event=stop'
|
||||||
2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04)
|
2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu:22.04)
|
||||||
2014-09-03T17:42:14.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
|
2014-09-03T17:42:14.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
|
||||||
|
|
||||||
$ docker events --filter 'image=ubuntu-1:14.04'
|
$ docker events --filter 'image=ubuntu:22.04'
|
||||||
2014-05-10T17:42:14.999999999Z07:00 container start 4386fb97867d (image=ubuntu-1:14.04)
|
2014-05-10T17:42:14.999999999Z07:00 container start 4386fb97867d (image=ubuntu:22.04)
|
||||||
2014-05-10T17:42:14.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04)
|
2014-05-10T17:42:14.999999999Z07:00 container die 4386fb97867d (image=ubuntu:22.04)
|
||||||
2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04)
|
2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu:22.04)
|
||||||
|
|
||||||
$ docker events --filter 'container=7805c1d35632'
|
$ docker events --filter 'container=7805c1d35632'
|
||||||
2014-05-10T17:42:14.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8)
|
2014-05-10T17:42:14.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8)
|
||||||
2014-09-03T15:49:29.999999999Z07:00 container stop 7805c1d35632 (image= redis:2.8)
|
2014-09-03T15:49:29.999999999Z07:00 container stop 7805c1d35632 (image= redis:2.8)
|
||||||
|
|
||||||
$ docker events --filter 'container=7805c1d35632' --filter 'container=4386fb97867d'
|
$ docker events --filter 'container=7805c1d35632' --filter 'container=4386fb97867d'
|
||||||
2014-09-03T15:49:29.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04)
|
2014-09-03T15:49:29.999999999Z07:00 container die 4386fb97867d (image=ubuntu:22.04)
|
||||||
2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04)
|
2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu:22.04)
|
||||||
2014-05-10T17:42:14.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8)
|
2014-05-10T17:42:14.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8)
|
||||||
2014-09-03T15:49:29.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
|
2014-09-03T15:49:29.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue