From 5c6723d080bcb0f1e8f9d9994ab2ea11a88cc955 Mon Sep 17 00:00:00 2001 From: Zeel B Patel Date: Sun, 30 Jan 2022 13:53:43 +0530 Subject: [PATCH 01/12] Correct device syntax to --gpus Signed-off-by: Zeel B Patel (cherry picked from commit 2d6ebd1e3e8d9788a36423f7af6b90a57d074067) Signed-off-by: Sebastiaan van Stijn --- docs/reference/commandline/run.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/commandline/run.md b/docs/reference/commandline/run.md index eb6906a01516..85e7b1521dfd 100644 --- a/docs/reference/commandline/run.md +++ b/docs/reference/commandline/run.md @@ -634,7 +634,7 @@ $ docker run -it --rm --gpus device=GPU-3a23c669-1f69-c64e-cf85-44e9b07e7a2a ubu The example below exposes the first and third GPUs. ```console -$ docker run -it --rm --gpus device=0,2 nvidia-smi +$ docker run -it --rm --gpus '"device=0,2"' nvidia-smi ``` ### Restart policies (--restart) From c9737e1c3792e0f4bdf059459d9077fd6edf18c3 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 11 Jan 2022 12:21:11 +0100 Subject: [PATCH 02/12] docs/daemon: replace deprecated '-g' option for '--data-root' Signed-off-by: Sebastiaan van Stijn (cherry picked from commit ae3a61439bac0c309066e9196e4c7413b317b0da) Signed-off-by: Sebastiaan van Stijn --- docs/reference/commandline/dockerd.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/reference/commandline/dockerd.md b/docs/reference/commandline/dockerd.md index 5f7a8d66d39c..c70be133c3d5 100644 --- a/docs/reference/commandline/dockerd.md +++ b/docs/reference/commandline/dockerd.md @@ -115,8 +115,8 @@ Options with [] may be specified multiple times. uses different binaries for the daemon and client. To run the daemon you type `dockerd`. -To run the daemon with debug output, use `dockerd -D` or add `"debug": true` to -the `daemon.json` file. +To run the daemon with debug output, use `dockerd --debug` or add `"debug": true` +to [the `daemon.json` file](#daemon-configuration-file). > **Enabling experimental features** > @@ -312,7 +312,7 @@ article explains how to tune your existing setup without the use of options. The `btrfs` driver is very fast for `docker build` - but like `devicemapper` does not share executable memory between devices. Use -`dockerd -s btrfs -g /mnt/btrfs_partition`. +`dockerd --storage-driver btrfs --data-root /mnt/btrfs_partition`. The `zfs` driver is probably not as fast as `btrfs` but has a longer track record on stability. Thanks to `Single Copy ARC` shared blocks between clones will be @@ -1233,14 +1233,14 @@ for `/var/lib/docker/tmp`. The `DOCKER_TMPDIR` and the data directory can be set like this: ```console -$ DOCKER_TMPDIR=/mnt/disk2/tmp /usr/local/bin/dockerd -D -g /var/lib/docker -H unix:// > /var/lib/docker-machine/docker.log 2>&1 +$ DOCKER_TMPDIR=/mnt/disk2/tmp /usr/local/bin/dockerd --data-root /var/lib/docker -H unix:// > /var/lib/docker-machine/docker.log 2>&1 ``` or ```console $ export DOCKER_TMPDIR=/mnt/disk2/tmp -$ /usr/local/bin/dockerd -D -g /var/lib/docker -H unix:// > /var/lib/docker-machine/docker.log 2>&1 +$ /usr/local/bin/dockerd --data-root /var/lib/docker -H unix:// > /var/lib/docker-machine/docker.log 2>&1 ```` #### Default cgroup parent From 40fe0573aaa27f12f62ba8d9acf2e1788c9cbede Mon Sep 17 00:00:00 2001 From: Mike Dalton <19153140+mikedalton@users.noreply.github.com> Date: Wed, 8 Dec 2021 16:48:38 +0900 Subject: [PATCH 03/12] Update Ubuntu version number references in push.md Ubuntu version references were a mixture of 14.04 (in descriptions) and 20.04 (in example code). Updated description references to 20.04 to match example code. Signed-off-by: Mike Dalton (cherry picked from commit 6ad2ceba3c9732e7e039f182f1761951bc7f837a) Signed-off-by: Sebastiaan van Stijn --- docs/reference/commandline/pull.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/reference/commandline/pull.md b/docs/reference/commandline/pull.md index cb65b32a2883..faa90ab681de 100644 --- a/docs/reference/commandline/pull.md +++ b/docs/reference/commandline/pull.md @@ -109,8 +109,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:14.04` pulls the latest version of the Ubuntu -14.04 image. +For example, `docker pull ubuntu:20.04` pulls the latest version of the Ubuntu +20.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 @@ -119,7 +119,7 @@ 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:20.04` image from Docker Hub: ```console $ docker pull ubuntu:20.04 From aa78937634612f4f5f58e6ef6d8aed35d32c5571 Mon Sep 17 00:00:00 2001 From: Pieter E Smit Date: Mon, 13 Dec 2021 11:39:33 +1300 Subject: [PATCH 04/12] Update stats.md add example json output Signed-off-by: Pieter E Smit (cherry picked from commit a1204a50b79dab091600e4e624aba7ce3b09a354) Signed-off-by: Sebastiaan van Stijn --- docs/reference/commandline/stats.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/reference/commandline/stats.md b/docs/reference/commandline/stats.md index 466b7ff12010..754a2f2316ff 100644 --- a/docs/reference/commandline/stats.md +++ b/docs/reference/commandline/stats.md @@ -85,6 +85,13 @@ b95a83497c91 awesome_brattain 0.28% 5.629MiB / 1.952GiB 67b2525d8ad1 foobar 0.00% 1.727MiB / 1.952GiB 0.09% 2.48kB / 0B 4.11MB / 0B 2 ``` +Running `docker stats` on container with name nginx and getting output in `json` format. + +```console +$ docker stats nginx --no-stream --format "{{ json . }}" +{"BlockIO":"0B / 13.3kB","CPUPerc":"0.03%","Container":"nginx","ID":"ed37317fbf42","MemPerc":"0.24%","MemUsage":"2.352MiB / 982.5MiB","Name":"nginx","NetIO":"539kB / 606kB","PIDs":"2"} +``` + Running `docker stats` with customized format on all (Running and Stopped) containers. ```console From e97c7b240ebe08fa6084db4957254c86333d704b Mon Sep 17 00:00:00 2001 From: jlecordier Date: Wed, 8 Dec 2021 18:02:45 +0100 Subject: [PATCH 05/12] added missing closing parenthese Signed-off-by: jlecordier (cherry picked from commit a185143707f4f159bc96709ad8a718450b9f7c8b) Signed-off-by: Sebastiaan van Stijn --- docs/reference/builder.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/builder.md b/docs/reference/builder.md index 1b214f65d4e8..526542938f42 100644 --- a/docs/reference/builder.md +++ b/docs/reference/builder.md @@ -112,7 +112,7 @@ instructions. Whenever possible, Docker uses a build-cache to accelerate the `docker build` process significantly. This is indicated by the `CACHED` message in the console -output. (For more information, see the [`Dockerfile` best practices guide](https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/): +output. (For more information, see the [`Dockerfile` best practices guide](https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/)): ```console $ docker build -t svendowideit/ambassador . From f1002eb9fbb381af4214f95f58a185c07543a929 Mon Sep 17 00:00:00 2001 From: Sandro Date: Mon, 18 Oct 2021 14:49:18 +0200 Subject: [PATCH 06/12] Fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sandro Jäckel (cherry picked from commit 2725f09873812976c58bf7026d7f877f30fc41ff) Signed-off-by: Sebastiaan van Stijn --- docs/reference/commandline/run.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/commandline/run.md b/docs/reference/commandline/run.md index 85e7b1521dfd..f8d8074010cc 100644 --- a/docs/reference/commandline/run.md +++ b/docs/reference/commandline/run.md @@ -719,7 +719,7 @@ $ docker run --ulimit nofile=1024:1024 --rm debian sh -c "ulimit -n" > In other words, the following script is not supported: > > ```console -> $ docker run -it --ulimit as=1024 fedora /bin/bash` +> $ docker run -it --ulimit as=1024 fedora /bin/bash > ``` The values are sent to the appropriate `syscall` as they are set. From 4065e1246e96d246ba1a28143e35a7aefcabf53b Mon Sep 17 00:00:00 2001 From: Gsealy Date: Thu, 2 Sep 2021 10:30:57 +0800 Subject: [PATCH 07/12] format create.md table Signed-off-by: Gsealy (cherry picked from commit b0ec87afd72e53dd7457a98d319bbfc375db2fc4) Signed-off-by: Sebastiaan van Stijn --- docs/reference/commandline/create.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/reference/commandline/create.md b/docs/reference/commandline/create.md index 5aa84eb2ae5a..d24caf7b721c 100644 --- a/docs/reference/commandline/create.md +++ b/docs/reference/commandline/create.md @@ -224,12 +224,11 @@ technology. On Linux, the only supported is the `default` option which uses Linux namespaces. On Microsoft Windows, you can specify these values: -| Value | Description | -|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `default` | Use the value specified by the Docker daemon's `--exec-opt` . If the `daemon` does not specify an isolation technology, Microsoft Windows uses `process` as its default value if the -daemon is running on Windows server, or `hyperv` if running on Windows client. | -| `process` | Namespace isolation only. | -| `hyperv` | Hyper-V hypervisor partition-based isolation. | +| Value | Description | +| --------- | ------------------------------------------------------------ | +| `default` | Use the value specified by the Docker daemon's `--exec-opt` . If the `daemon` does not specify an isolation technology, Microsoft Windows uses `process` as its default value if the daemon is running on Windows server, or `hyperv` if running on Windows client. | +| `process` | Namespace isolation only. | +| `hyperv` | Hyper-V hypervisor partition-based isolation. | Specifying the `--isolation` flag without a value is the same as setting `--isolation="default"`. From b721998b7b88311828829fa74a3713206f7e690f Mon Sep 17 00:00:00 2001 From: Brad Baker <88946291+brdbkr@users.noreply.github.com> Date: Thu, 26 Aug 2021 02:36:25 -0400 Subject: [PATCH 08/12] Fixing typo (his --> its) Signed-off-by: Brad Baker (cherry picked from commit 172b2dc37e21bfe37a169cfb7ac6ba1ce8ed9f56) Signed-off-by: Sebastiaan van Stijn --- docs/reference/commandline/run.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/commandline/run.md b/docs/reference/commandline/run.md index f8d8074010cc..2878ddbdfcdc 100644 --- a/docs/reference/commandline/run.md +++ b/docs/reference/commandline/run.md @@ -348,7 +348,7 @@ explains in detail how to manipulate ports in Docker. Note that ports which are not bound to the host (i.e., `-p 80:80` instead of `-p 127.0.0.1:80:80`) will be accessible from the outside. This also applies if -you configured UFW to block this specific port, as Docker manages his +you configured UFW to block this specific port, as Docker manages its own iptables rules. [Read more](https://docs.docker.com/network/iptables/) ```console From 04104a04d35805e8670de2abb605c4cb4f5d72c6 Mon Sep 17 00:00:00 2001 From: Leonid Skorospelov Date: Thu, 29 Jul 2021 13:55:41 +0000 Subject: [PATCH 09/12] Update dockerd.md Simple typo Signed-off-by: Leonid Skorospelov (cherry picked from commit 0ca2d25ba84366b141db44bccce8c39b9104af72) Signed-off-by: Sebastiaan van Stijn --- docs/reference/commandline/dockerd.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/commandline/dockerd.md b/docs/reference/commandline/dockerd.md index c70be133c3d5..c016da6081e7 100644 --- a/docs/reference/commandline/dockerd.md +++ b/docs/reference/commandline/dockerd.md @@ -1554,7 +1554,7 @@ The list of currently supported options that can be reconfigured is this: be used to run containers. - `authorization-plugin`: it specifies the authorization plugins to use. - `allow-nondistributable-artifacts`: Replaces the set of registries to which the daemon will push nondistributable artifacts with a new set of registries. -- `insecure-registries`: it replaces the daemon insecure registries with a new set of insecure registries. If some existing insecure registries in daemon's configuration are not in newly reloaded insecure resgitries, these existing ones will be removed from daemon's config. +- `insecure-registries`: it replaces the daemon insecure registries with a new set of insecure registries. If some existing insecure registries in daemon's configuration are not in newly reloaded insecure registries, these existing ones will be removed from daemon's config. - `registry-mirrors`: it replaces the daemon registry mirrors with a new set of registry mirrors. If some existing registry mirrors in daemon's configuration are not in newly reloaded registry mirrors, these existing ones will be removed from daemon's config. - `shutdown-timeout`: it replaces the daemon's existing configuration timeout with a new timeout for shutting down all containers. - `features`: it explicitly enables or disables specific features. From c0e952cf0427b8c2daf1f78b7615c537cb97348d Mon Sep 17 00:00:00 2001 From: Takuya Noguchi Date: Mon, 28 Jun 2021 06:03:28 +0000 Subject: [PATCH 10/12] Fix the (dead) link for docs for Dockerfile syntax reference This change will update the docs at https://docs.docker.com/engine/reference/builder/#buildkit This change is required by https://github.com/moby/buildkit/pull/1884 Signed-off-by: Takuya Noguchi (cherry picked from commit 0c723fd68ae75a69090fad4a858d32e014b79b0a) Signed-off-by: Sebastiaan van Stijn --- docs/reference/builder.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/builder.md b/docs/reference/builder.md index 526542938f42..ce14b741c3f3 100644 --- a/docs/reference/builder.md +++ b/docs/reference/builder.md @@ -159,8 +159,8 @@ implementation. For example, BuildKit can: To use the BuildKit backend, you need to set an environment variable `DOCKER_BUILDKIT=1` on the CLI before invoking `docker build`. -To learn about the experimental Dockerfile syntax available to BuildKit-based -builds [refer to the documentation in the BuildKit repository](https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/experimental.md). +To learn about the Dockerfile syntax available to BuildKit-based +builds [refer to the documentation in the BuildKit repository](https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/syntax.md). ## Format From 62d27c32ffd5042e79b0e3acebb134e384754b65 Mon Sep 17 00:00:00 2001 From: Govind Rai Date: Wed, 16 Jun 2021 16:47:28 -0700 Subject: [PATCH 11/12] Update WORKDIR command information Signed-off-by: Govind Rai (cherry picked from commit e12aade59585f360e3f87def2c67699c7feaf95d) Signed-off-by: Sebastiaan van Stijn --- docs/reference/builder.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/reference/builder.md b/docs/reference/builder.md index ce14b741c3f3..7e73282a7c00 100644 --- a/docs/reference/builder.md +++ b/docs/reference/builder.md @@ -1824,6 +1824,11 @@ RUN pwd The output of the final `pwd` command in this `Dockerfile` would be `/path/$DIRNAME` +If not specified, the default working directory is `/`. In practice, if you aren't building a Dockerfile from scratch (`FROM scratch`), +the `WORKDIR` may likely be set by the base image you're using. + +Therefore, to avoid unintended operations in unknown directories, it is best practice to set your `WORKDIR` explicitly. + ## ARG ```dockerfile From 700364e3045be6eef86f8d2e7645e2f6df92f709 Mon Sep 17 00:00:00 2001 From: Jon Zeolla Date: Mon, 22 Feb 2021 16:00:43 -0500 Subject: [PATCH 12/12] Fix mistake with env var example in docker run docs Signed-off-by: Jon Zeolla (cherry picked from commit cb1bb72fd9956ab572fc202305e975c76dc666f4) Signed-off-by: Sebastiaan van Stijn --- docs/reference/commandline/run.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/commandline/run.md b/docs/reference/commandline/run.md index 2878ddbdfcdc..efead707352c 100644 --- a/docs/reference/commandline/run.md +++ b/docs/reference/commandline/run.md @@ -403,10 +403,10 @@ VAR1=value1 VAR2=value2 USER -$ docker run --env-file env.list ubuntu env | grep VAR +$ docker run --env-file env.list ubuntu env | grep -E 'VAR|USER' VAR1=value1 VAR2=value2 -USER=denis +USER=jonzeolla ``` ### Set metadata on container (-l, --label, --label-file)