From 9ba371f66586197ee7924649431774bbaf3cc6f2 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 6 Jun 2022 15:02:58 +0200 Subject: [PATCH] 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 --- docs/reference/commandline/commit.md | 16 +-- docs/reference/commandline/events.md | 4 +- docs/reference/commandline/ps.md | 10 +- docs/reference/commandline/pull.md | 126 ++++++++--------- docs/reference/commandline/service_create.md | 2 +- docs/reference/commandline/system_events.md | 4 +- docs/reference/run.md | 42 +++--- man/src/container/ls.md | 12 +- man/src/image/ls.md | 2 +- man/src/image/pull.md | 140 +++++++++---------- man/src/system/events.md | 18 +-- 11 files changed, 186 insertions(+), 190 deletions(-) diff --git a/docs/reference/commandline/commit.md b/docs/reference/commandline/commit.md index d8f812b6bb..524e5e714f 100644 --- a/docs/reference/commandline/commit.md +++ b/docs/reference/commandline/commit.md @@ -50,8 +50,8 @@ created. Supported `Dockerfile` instructions: $ 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 +c3f279d17e0a ubuntu:22.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky +197387f1b436 ubuntu:22.04 /bin/bash 7 days ago Up 25 hours focused_hamilton $ docker commit c3f279d17e0a svendowideit/testimage:version3 @@ -69,8 +69,8 @@ svendowideit/testimage version3 f5283438590d 16 sec $ 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 +c3f279d17e0a ubuntu:22.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky +197387f1b436 ubuntu:22.04 /bin/bash 7 days ago Up 25 hours focused_hamilton $ docker inspect -f "{{ .Config.Env }}" c3f279d17e0a @@ -91,8 +91,8 @@ $ docker inspect -f "{{ .Config.Env }}" f5283438590d $ 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 +c3f279d17e0a ubuntu:22.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky +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 @@ -106,6 +106,6 @@ $ 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 +c3f279d17e0a ubuntu:22.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky +197387f1b436 ubuntu:22.04 /bin/bash 7 days ago Up 25 hours focused_hamilton ``` diff --git a/docs/reference/commandline/events.md b/docs/reference/commandline/events.md index 79c85874e4..d28d1d679a 100644 --- a/docs/reference/commandline/events.md +++ b/docs/reference/commandline/events.md @@ -343,8 +343,8 @@ $ docker events --filter 'type=network' $ 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-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:22.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) diff --git a/docs/reference/commandline/ps.md b/docs/reference/commandline/ps.md index 093b26f110..710da03474 100644 --- a/docs/reference/commandline/ps.md +++ b/docs/reference/commandline/ps.md @@ -57,7 +57,7 @@ Running `docker ps --no-trunc` showing 2 linked containers. $ docker ps --no-trunc 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 ``` @@ -254,13 +254,13 @@ CONTAINER ID IMAGE COMMAND CREATED 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 -$ docker ps --filter ancestor=ubuntu:12.04.5 +$ docker ps --filter ancestor=ubuntu:22.04 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 @@ -270,7 +270,7 @@ that have this layer in its layer stack. $ 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 +82a598284012 ubuntu:22.04 "top" 3 minutes ago Up 3 minutes sleepy_bose ``` #### Create time diff --git a/docs/reference/commandline/pull.md b/docs/reference/commandline/pull.md index c0c2b35963..eb02d9ef34 100644 --- a/docs/reference/commandline/pull.md +++ b/docs/reference/commandline/pull.md @@ -53,36 +53,36 @@ this via the `--max-concurrent-downloads` daemon option. See the ### 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: +`docker image pull` (or the `docker pull` shorthand). If no tag is provided, +Docker Engine uses the `:latest` tag as a default. This example pulls the +`debian:latest` image: ```console -$ docker pull debian +$ docker image pull debian Using default tag: latest latest: Pulling from library/debian -fdd5d7827f33: Pull complete -a3ed95caeb02: Pull complete -Digest: sha256:e7d38b3517548a1c71e41bffe9c8ae6d6d29546ce46bf62159837aad072c90aa +e756f3fdd6a3: Pull complete +Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510 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 -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 -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: +Layers can be reused by images. For example, the `debian:bullseye` image shares +its layer with the `debian:latest`. Pulling the `debian:bullseye` image therefore +only pulls its metadata, but not its layers, because the layer is already present +locally: ```console -$ docker pull debian:jessie +$ docker image pull debian:bullseye -jessie: Pulling from library/debian -fdd5d7827f33: Already exists -a3ed95caeb02: Already exists -Digest: sha256:a9c958be96d7d40df920e7041608f2f017af81800ca5ad23e327bc402626b58e -Status: Downloaded newer image for debian:jessie +bullseye: Pulling from library/debian +Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510 +Status: Downloaded newer image for debian:bullseye +docker.io/library/debian:bullseye ``` To see which images are present locally, use the [`docker images`](images.md) @@ -91,17 +91,16 @@ command: ```console $ 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 +REPOSITORY TAG IMAGE ID CREATED SIZE +debian bullseye 4eacea30377a 8 days ago 124MB +debian latest 4eacea30377a 8 days ago 124MB ``` 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. +`debian:bullseye` and `debian:latest` have the same image ID because they are +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/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 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:20.04` pulls the latest version of the Ubuntu -20.04 image. +For example, `docker pull ubuntu:22.04` pulls the latest version of the Ubuntu +22.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 @@ -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. 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 -$ docker pull ubuntu:20.04 +$ docker pull ubuntu:22.04 -20.04: Pulling from library/ubuntu -16ec32c2132b: Pull complete -Digest: sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3 -Status: Downloaded newer image for ubuntu:20.04 -docker.io/library/ubuntu:20.04 +22.04: Pulling from library/ubuntu +125a6e411906: Pull complete +Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d +Status: Downloaded newer image for ubuntu:22.04 +docker.io/library/ubuntu:22.04 ``` Docker prints the digest of the image after the pull has finished. In the example above, the digest of the image is: ```console -sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3 +sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d ``` 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: ```console -$ docker pull ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3 +$ docker pull ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d -docker.io/library/ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3: Pulling from library/ubuntu -Digest: sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3 -Status: Image is up to date for ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3 -docker.io/library/ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3 +docker.io/library/ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d: Pulling from library/ubuntu +Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d +Status: Image is up to date for ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d +docker.io/library/ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d ``` Digest can also be used in the `FROM` of a Dockerfile, for example: ```dockerfile -FROM ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3 +FROM ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d LABEL org.opencontainers.image.authors="some maintainer " ``` > **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 +> 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 > 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`): ```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). @@ -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 `-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 -$ docker pull --all-tags fedora +$ docker image pull --all-tags ubuntu -Pulling repository fedora +Pulling repository ubuntu ad57ef8d78d7: Download complete 105182bb5e8b: Download complete 511136ea3c5a: 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 -images that were pulled. The example below shows all the `fedora` images -that are present locally: +After the pull has completed use the `docker image ls` command (or the `docker images` +shorthand) to see the images that were pulled. The example below shows all the +`ubuntu` images that are present locally: ```console -$ 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 +$ 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 ``` ### 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. ```console -$ docker pull fedora +$ docker pull ubuntu Using default tag: latest -latest: Pulling from library/fedora +latest: Pulling from library/ubuntu a3ed95caeb02: Pulling fs layer 236608c7b546: Pulling fs layer ^C ``` -> **Note** -> -> 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. +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 +command is manually terminated. diff --git a/docs/reference/commandline/service_create.md b/docs/reference/commandline/service_create.md index 008fe61bb1..4b84a623cf 100644 --- a/docs/reference/commandline/service_create.md +++ b/docs/reference/commandline/service_create.md @@ -678,7 +678,7 @@ follows: | `node.platform.os` | Node operating system | `node.platform.os==windows` | | `node.platform.arch` | Node architecture | `node.platform.arch==x86_64` | | `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, etc. Swarm administrators add `node.labels` for operational purposes by using diff --git a/docs/reference/commandline/system_events.md b/docs/reference/commandline/system_events.md index 7648eb3590..6135de2b13 100644 --- a/docs/reference/commandline/system_events.md +++ b/docs/reference/commandline/system_events.md @@ -281,8 +281,8 @@ $ docker system events --filter 'type=network' $ 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-05-10T17:42:14.999999999Z07:00 container stop 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:22.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) diff --git a/docs/reference/run.md b/docs/reference/run.md index d81dbedb52..767e441ee4 100644 --- a/docs/reference/run.md +++ b/docs/reference/run.md @@ -187,7 +187,7 @@ PID files): 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 -example, `docker run ubuntu:14.04`. +example, `docker run ubuntu:22.04`. ### Image[@digest] @@ -837,14 +837,14 @@ We have four ways to set user memory usage: Examples: ```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 as much memory and swap memory as they need. ```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 @@ -852,7 +852,7 @@ the container can use 300M memory and as much swap memory as they need (if the host supports swap memory). ```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 @@ -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. ```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 @@ -887,7 +887,7 @@ The following example limits the memory (`-m`) to 500M and sets the memory reservation to 200M. ```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 @@ -897,7 +897,7 @@ memory below 200M. The following example set memory reservation to 1G without a hard memory limit. ```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 @@ -915,13 +915,13 @@ The following example limits the memory to 100M and disables the OOM killer for this container: ```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: ```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 @@ -991,14 +991,14 @@ limit and "K" the kernel limit. There are three possible ways to set limits: Examples: ```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 500M memory in total, in this 500M memory, it can be 50M kernel memory tops. ```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 @@ -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: ```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 @@ -1066,7 +1066,7 @@ And usually `--cpu-period` should work with `--cpu-quota`. Examples: ```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. @@ -1087,13 +1087,13 @@ We can set cpus in which to allow execution for containers. Examples: ```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. ```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. @@ -1104,14 +1104,14 @@ on NUMA systems. Examples: ```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 memory nodes 1 and 3. ```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 @@ -1143,8 +1143,8 @@ For example, the commands below create two containers with different blkio weight: ```console -$ docker run -it --name c1 --blkio-weight 300 ubuntu:14.04 /bin/bash -$ docker run -it --name c2 --blkio-weight 600 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:22.04 /bin/bash ``` 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. ```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 -$ 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 diff --git a/man/src/container/ls.md b/man/src/container/ls.md index 2bbef0c16e..5c8541721d 100644 --- a/man/src/container/ls.md +++ b/man/src/container/ls.md @@ -48,10 +48,10 @@ Valid placeholders for the Go template are listed below: $ 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 + a87ecb4f327c ubuntu:22.04 /bin/sh -c #(nop) MA 20 minutes ago Exit 0 desperate_brattain + 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 - 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 @@ -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")}}' CONTAINER ID NODE - a87ecb4f327c ubuntu + a87ecb4f327c worker-1 01946d9d34d8 - c1d3b0166030 debian - 41d50ecd2f57 fedora + c1d3b0166030 worker-1 + 41d50ecd2f57 worker-2 ## Display containers with `remote-volume` mounted diff --git a/man/src/image/ls.md b/man/src/image/ls.md index cf15937e06..ba6a708adf 100644 --- a/man/src/image/ls.md +++ b/man/src/image/ls.md @@ -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 (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 -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. ## Filters diff --git a/man/src/image/pull.md b/man/src/image/pull.md index 13d601e99f..7b6f1f2a40 100644 --- a/man/src/image/pull.md +++ b/man/src/image/pull.md @@ -11,52 +11,51 @@ registry located at `registry-1.docker.io` by default. ### Pull an image from Docker Hub 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 -default. This command pulls the `debian:latest` image: +`docker image pull` (or the `docker pull` shorthand). If no tag is provided, +Docker Engine uses the `:latest` tag as a default. This example pulls the +`debian:latest` image: $ docker image pull debian Using default tag: latest latest: Pulling from library/debian - fdd5d7827f33: Pull complete - a3ed95caeb02: Pull complete - Digest: sha256:e7d38b3517548a1c71e41bffe9c8ae6d6d29546ce46bf62159837aad072c90aa + e756f3fdd6a3: Pull complete + Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510 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 -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 -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: +Layers can be reused by images. For example, the `debian:bullseye` image shares +its layer with the `debian:latest`. Pulling the `debian:bullseye` image therefore +only pulls its metadata, but not its layers, because the layer is already present +locally: - $ docker image pull debian:jessie + $ docker image pull debian:bullseye - jessie: Pulling from library/debian - fdd5d7827f33: Already exists - a3ed95caeb02: Already exists - Digest: sha256:a9c958be96d7d40df920e7041608f2f017af81800ca5ad23e327bc402626b58e - Status: Downloaded newer image for debian:jessie + bullseye: Pulling from library/debian + Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510 + Status: Downloaded newer image for debian:bullseye + docker.io/library/debian:bullseye To see which images are present locally, use the **docker-images(1)** command: $ 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 + REPOSITORY TAG IMAGE ID CREATED SIZE + debian bullseye 4eacea30377a 8 days ago 124MB + debian latest 4eacea30377a 8 days ago 124MB 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. +`debian:bullseye` and `debian:latest` have the same image ID because they are +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 [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. @@ -65,8 +64,8 @@ in the online documentation. 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 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 -14.04 image. +For example, `docker image pull ubuntu:22.04` pulls the latest version of the Ubuntu +22.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 @@ -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. 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 - 5a132a7e7af1: Pull complete - fd2731e4c50c: Pull complete - 28a2f68d1120: Pull complete - a3ed95caeb02: Pull complete - Digest: sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2 - Status: Downloaded newer image for ubuntu:14.04 + 22.04: Pulling from library/ubuntu + 125a6e411906: Pull complete + Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d + Status: Downloaded newer image for ubuntu:22.04 + docker.io/library/ubuntu:22.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 + sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d 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 +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: - $ docker image pull ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2 + $ docker image pull ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d - 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 + docker.io/library/ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d: Pulling from library/ubuntu + Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d + Status: Image is up to date for ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d + docker.io/library/ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d 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 " -> **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 +> **Note** +> +> 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 > 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 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 `-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 105182bb5e8b: Download complete 511136ea3c5a: 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 -images that were pulled. The example below shows all the `fedora` images -that are present locally: +After the pull has completed use the `docker image ls` (or `docker images` shorthand) +command to see the images that were pulled. The example below shows all the `ubuntu` +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 - 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 +## Cancel a pull Killing the `docker image pull` process, for example by pressing `CTRL-c` while it is running in a terminal, will terminate the pull operation. - $ docker image pull fedora + $ docker image pull ubuntu Using default tag: latest - latest: Pulling from library/fedora + latest: Pulling from library/ubuntu 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. +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. diff --git a/man/src/system/events.md b/man/src/system/events.md index 44adc6c397..8177293f53 100644 --- a/man/src/system/events.md +++ b/man/src/system/events.md @@ -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: # docker events --since '3m' - 2015-05-12T11:51:30.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) die - 2015-05-12T15:52:12.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) stop + 2015-05-12T11:51:30.999999999Z07:00 4386fb97867d: (from ubuntu:22.04) die + 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: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 $ 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) - $ docker events --filter 'image=ubuntu-1:14.04' - 2014-05-10T17:42:14.999999999Z07:00 container start 4386fb97867d (image=ubuntu-1:14.04) - 2014-05-10T17:42:14.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) + $ docker events --filter 'image=ubuntu:22.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:22.04) + 2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu:22.04) $ docker events --filter 'container=7805c1d35632' 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) $ docker events --filter 'container=7805c1d35632' --filter 'container=4386fb97867d' - 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-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:22.04) 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)