From bb68afd0fc0ea5dfa0f46385f883fbfaa45fa99a Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 21 Mar 2018 19:00:11 +0100 Subject: [PATCH 1/9] Docs touch-ups for "autoremove" and broken anchor `--rm` moved to the daemon, so is now also supported when combined with `-d`. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit e9ce688d6e6d990794b51fac5ed2fed619c89f4f) Signed-off-by: Sebastiaan van Stijn --- components/cli/docs/reference/commandline/run.md | 4 ++-- components/cli/docs/reference/run.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/cli/docs/reference/commandline/run.md b/components/cli/docs/reference/commandline/run.md index da5254475e..71d6c6348b 100644 --- a/components/cli/docs/reference/commandline/run.md +++ b/components/cli/docs/reference/commandline/run.md @@ -592,7 +592,7 @@ Docker supports the following restart policies: |:---------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `no` | Do not automatically restart the container when it exits. This is the default. | | `on-failure[:max-retries]` | Restart only if the container exits with a non-zero exit status. Optionally, limit the number of restart retries the Docker daemon attempts. | -| `unless-stopped` | Restart the container unless it is explicitly stopped or Docker itself is stopped or restarted. | +| `unless-stopped` | Restart the container unless it is explicitly stopped or Docker itself is stopped or restarted. | | `always` | Always restart the container regardless of the exit status. When you specify always, the Docker daemon will try to restart the container indefinitely. The container will also always start on daemon startup, regardless of the current state of the container. | ```bash @@ -603,7 +603,7 @@ This will run the `redis` container with a restart policy of **always** so that if the container exits, Docker will restart it. More detailed information on restart policies can be found in the -[Restart Policies (--restart)](../run.md#restart-policies-restart) +[Restart Policies (--restart)](../run.md#restart-policies---restart) section of the Docker run reference page. ### Add entries to container hosts file (--add-host) diff --git a/components/cli/docs/reference/run.md b/components/cli/docs/reference/run.md index b65504b62b..5c393d60cf 100644 --- a/components/cli/docs/reference/run.md +++ b/components/cli/docs/reference/run.md @@ -620,7 +620,7 @@ systems can really pile up. If instead you'd like Docker to **automatically clean up the container and remove the file system when the container exits**, you can add the `--rm` flag: - --rm=false: Automatically remove the container when it exits (incompatible with -d) + --rm=false: Automatically remove the container when it exits > **Note**: When you set the `--rm` flag, Docker also removes the anonymous volumes associated with the container when the container is removed. This is similar From 1df656a2f08660a7c6b02fa909c77fdf5182db79 Mon Sep 17 00:00:00 2001 From: David Beitey Date: Sun, 25 Mar 2018 14:14:12 +0000 Subject: [PATCH 2/9] Clarify behaviour of restart policy in run ref doc This clarifies that the behaviour of `unless-stopped` will restart the container on daemon start. This was implied before, but now the restart-on-daemon-start behaviour is mentioned directly. Signed-off-by: David Beitey (cherry picked from commit 8ca237054f13c585ce5880c2c193d106ac22c9cd) Signed-off-by: Sebastiaan van Stijn --- components/cli/docs/reference/run.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/cli/docs/reference/run.md b/components/cli/docs/reference/run.md index 5c393d60cf..3a6bf5b662 100644 --- a/components/cli/docs/reference/run.md +++ b/components/cli/docs/reference/run.md @@ -525,9 +525,9 @@ Docker supports the following restart policies: unless-stopped - Always restart the container regardless of the exit status, but - do not start it on daemon startup if the container has been put - to a stopped state before. + Always restart the container regardless of the exit status, + including on daemon startup, except if the container was put + into a stopped state before the Docker daemon was stopped. From 27540de1ad9df4ac9105b1f2729d0040ceed5474 Mon Sep 17 00:00:00 2001 From: Preston Cowley Date: Mon, 26 Mar 2018 14:28:49 -0700 Subject: [PATCH 3/9] Update build.md Explicitly stated that you must add --build-arg for each build argument. Added multiple arguments to example of `--build-arg` usage. Fix for https://github.com/docker/docker.github.io/issues/6248 Signed-off-by: Preston Cowley (cherry picked from commit ad44e2d45e35d09890473e20f6b2ad16de98d72a) Signed-off-by: Sebastiaan van Stijn --- components/cli/docs/reference/commandline/build.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/cli/docs/reference/commandline/build.md b/components/cli/docs/reference/commandline/build.md index 01ab913eca..77c6f4519d 100644 --- a/components/cli/docs/reference/commandline/build.md +++ b/components/cli/docs/reference/commandline/build.md @@ -411,13 +411,13 @@ files. The `ARG` instruction lets Dockerfile authors define values that users can set at build-time using the `--build-arg` flag: ```bash -$ docker build --build-arg HTTP_PROXY=http://10.20.30.2:1234 . +$ docker build --build-arg HTTP_PROXY=http://10.20.30.2:1234 --build-arg FTP_PROXY=http://40.50.60.5:4567 . ``` This flag allows you to pass the build-time variables that are accessed like regular environment variables in the `RUN` instruction of the Dockerfile. Also, these values don't persist in the intermediate or final images -like `ENV` values do. +like `ENV` values do. You must add `--build-arg` for each build argument. Using this flag will not alter the output you see when the `ARG` lines from the Dockerfile are echoed during the build process. From 24306165c5362837ebef89461a8ceffc2ef66f0a Mon Sep 17 00:00:00 2001 From: Joao Fernandes Date: Mon, 2 Apr 2018 15:15:19 -0700 Subject: [PATCH 4/9] Use printf, not echo when creating secrets Update the docs so that users don't use `echo` when creating secrets from STDIN. `echo` adds a trailing new line, so users will probably be confused when their passwords don't work. Signed-off-by: Joao Fernandes (cherry picked from commit 5238f3e93e6141b3615e7c8b38adae5ea2175385) Signed-off-by: Sebastiaan van Stijn --- components/cli/docs/reference/commandline/secret_create.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/cli/docs/reference/commandline/secret_create.md b/components/cli/docs/reference/commandline/secret_create.md index a1164a9809..66fc78f9f8 100644 --- a/components/cli/docs/reference/commandline/secret_create.md +++ b/components/cli/docs/reference/commandline/secret_create.md @@ -27,7 +27,7 @@ Options: ## Description -Creates a secret using standard input or from a file for the secret content. You must run this command on a manager node. +Creates a secret using standard input or from a file for the secret content. You must run this command on a manager node. For detailed information about using secrets, refer to [manage sensitive data with Docker secrets](https://docs.docker.com/engine/swarm/secrets/). @@ -36,7 +36,7 @@ For detailed information about using secrets, refer to [manage sensitive data wi ### Create a secret ```bash -$ echo | docker secret create my_secret - +$ printf | docker secret create my_secret - onakdyv307se2tl7nl20anokv From 4e72a2fd514a58298b6258f07d58b2d51469f6fb Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 2 Apr 2018 16:07:40 -0700 Subject: [PATCH 5/9] Fix --format example for docker history Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 2f7bf40e733e337dadc998ae99d93fe5da5e4a16) Signed-off-by: Sebastiaan van Stijn --- .../cli/docs/reference/commandline/history.md | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/components/cli/docs/reference/commandline/history.md b/components/cli/docs/reference/commandline/history.md index c05bbca8d1..6814501287 100644 --- a/components/cli/docs/reference/commandline/history.md +++ b/components/cli/docs/reference/commandline/history.md @@ -77,17 +77,11 @@ output the data exactly as the template declares or, when using the `table` directive, will include column headers as well. The following example uses a template without headers and outputs the -`ID` and `CreatedSince` entries separated by a colon for all images: +`ID` and `CreatedSince` entries separated by a colon for the `busybox` image: ```bash -$ docker images --format "{{.ID}}: {{.Created}} ago" +$ docker history --format "{{.ID}}: {{.CreatedAt}}" busybox -cc1b61406712: 2 weeks ago -: 2 weeks ago -: 2 weeks ago -: 2 weeks ago -: 2 weeks ago -: 3 weeks ago -: 3 weeks ago -: 3 weeks ago +f6e427c148a7: 4 weeks ago +: 4 weeks ago ``` From 766c24e5542934d4112ab685fe71438ce55b8dae Mon Sep 17 00:00:00 2001 From: Anusha Ragunathan Date: Thu, 5 Apr 2018 12:14:59 -0700 Subject: [PATCH 6/9] Update examples to reflect docker-runc's runtime root for plugins. Signed-off-by: Anusha Ragunathan (cherry picked from commit 5fd9eab3d0cec4d1fb3d03cd9eb4c250cf2bd23a) Signed-off-by: Sebastiaan van Stijn --- components/cli/docs/extend/index.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/components/cli/docs/extend/index.md b/components/cli/docs/extend/index.md index 6817ea8f57..4e8cae9855 100644 --- a/components/cli/docs/extend/index.md +++ b/components/cli/docs/extend/index.md @@ -218,20 +218,22 @@ plugins. This is specifically useful to collect plugin logs if they are redirected to a file. ```bash -$ docker-runc list -ID PID STATUS BUNDLE CREATED -f52a3df433b9aceee436eaada0752f5797aab1de47e5485f1690a073b860ff62 2679 running /run/docker/libcontainerd/f52a3df433b9aceee436eaada0752f5797aab1de47e5485f1690a073b860ff62 2017-02-06T21:53:03.031537592Z -r +$ sudo docker-runc --root /var/run/docker/plugins/runtime-root/moby-plugins list + +ID PID STATUS BUNDLE CREATED OWNER +93f1e7dbfe11c938782c2993628c895cf28e2274072c4a346a6002446c949b25 15806 running /run/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby-plugins/93f1e7dbfe11c938782c2993628c895cf28e2274072c4a346a6002446c949b25 2018-02-08T21:40:08.621358213Z root +9b4606d84e06b56df84fadf054a21374b247941c94ce405b0a261499d689d9c9 14992 running /run/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby-plugins/9b4606d84e06b56df84fadf054a21374b247941c94ce405b0a261499d689d9c9 2018-02-08T21:35:12.321325872Z root +c5bb4b90941efcaccca999439ed06d6a6affdde7081bb34dc84126b57b3e793d 14984 running /run/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby-plugins/c5bb4b90941efcaccca999439ed06d6a6affdde7081bb34dc84126b57b3e793d 2018-02-08T21:35:12.321288966Z root ``` ```bash -$ docker-runc exec f52a3df433b9aceee436eaada0752f5797aab1de47e5485f1690a073b860ff62 cat /var/log/plugin.log +$ sudo docker-runc --root /var/run/docker/plugins/runtime-root/moby-plugins exec 93f1e7dbfe11c938782c2993628c895cf28e2274072c4a346a6002446c949b25 cat /var/log/plugin.log ``` If the plugin has a built-in shell, then exec into the plugin can be done as follows: ```bash -$ docker-runc exec -t f52a3df433b9aceee436eaada0752f5797aab1de47e5485f1690a073b860ff62 sh +$ sudo docker-runc --root /var/run/docker/plugins/runtime-root/moby-plugins exec -t 93f1e7dbfe11c938782c2993628c895cf28e2274072c4a346a6002446c949b25 sh ``` #### Using curl to debug plugin socket issues. From 39f7e7efd0e847b558d4c25547a9ead026d11e5a Mon Sep 17 00:00:00 2001 From: Per Lundberg Date: Thu, 12 Apr 2018 11:58:13 +0300 Subject: [PATCH 7/9] build.md: Document --build-arg without value This use case is currently _working correctly_, which is nice, but there is no documentation to be found about it. This PR fixes that. Signed-off-by: Per Lundberg (cherry picked from commit 82c23208eeba822473d444221399a7102479a702) Signed-off-by: Sebastiaan van Stijn --- .../cli/docs/reference/commandline/build.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/components/cli/docs/reference/commandline/build.md b/components/cli/docs/reference/commandline/build.md index 77c6f4519d..3dfed3fffe 100644 --- a/components/cli/docs/reference/commandline/build.md +++ b/components/cli/docs/reference/commandline/build.md @@ -425,6 +425,18 @@ Dockerfile are echoed during the build process. For detailed information on using `ARG` and `ENV` instructions, see the [Dockerfile reference](../builder.md). +You may also use the `--build-arg` flag without a value, in which case the value +from the local environment will be propagated into the Docker container being +built: + +```bash +$ export HTTP_PROXY=http://10.20.30.2:1234 +$ docker build --build-arg HTTP_PROXY . +``` + +This is similar to how `docker run -e` works. Refer to the [`docker run` documentation](https://docs.docker.com/engine/reference/commandline/run/#set-environment-variables--e---env---env-file) +for more information. + ### Optional security options (--security-opt) This flag is only supported on a daemon running on Windows, and only supports @@ -504,7 +516,7 @@ section in the userguide for more information. The `--squash` option has a number of known limitations: -- When squashing layers, the resulting image cannot take advantage of layer +- When squashing layers, the resulting image cannot take advantage of layer sharing with other images, and may use significantly more space. Sharing the base image is still supported. - When using this option you may see significantly more space used due to @@ -581,7 +593,7 @@ $ docker build --squash -t test . If everything is right, the history will look like this: ```bash -$ docker history test +$ docker history test IMAGE CREATED CREATED BY SIZE COMMENT 4e10cb5b4cac 3 seconds ago 12 B merge sha256:88a7b0112a41826885df0e7072698006ee8f621c6ab99fca7fe9151d7b599702 to sha256:47bcc53f74dc94b1920f0b34f6036096526296767650f223433fe65c35f149eb From 79e8ae0e9d1a2f450f9a54249bfa4448103bdb4b Mon Sep 17 00:00:00 2001 From: Henry N Date: Mon, 16 Apr 2018 16:01:53 +0200 Subject: [PATCH 8/9] docker load: Typofix in examples Remove the double "docker docker" from example Signed-off-by: Henry Ne (cherry picked from commit 79c489d812524ae5a0ff26c44fa4bb2e309810bb) Signed-off-by: Sebastiaan van Stijn --- components/cli/docs/reference/commandline/load.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/cli/docs/reference/commandline/load.md b/components/cli/docs/reference/commandline/load.md index 1c1d57f4fb..2bb99b87bb 100644 --- a/components/cli/docs/reference/commandline/load.md +++ b/components/cli/docs/reference/commandline/load.md @@ -35,7 +35,7 @@ bzip2, or xz) from a file or STDIN. It restores both images and tags. ## Examples ```bash -$ docker docker image ls +$ docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE From da69d9e253913a4eca2c6ca75eb378d6fea89c85 Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Sat, 14 Apr 2018 14:46:19 +0200 Subject: [PATCH 9/9] Add bash completion for `secret|config create --template-driver` Signed-off-by: Harald Albers (cherry picked from commit 43024e2d57d7bdd63c358ac65bc3c6d1e6a4d702) Signed-off-by: Sebastiaan van Stijn --- components/cli/contrib/completion/bash/docker | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/components/cli/contrib/completion/bash/docker b/components/cli/contrib/completion/bash/docker index a3f1bd0db0..ca64d5396f 100644 --- a/components/cli/contrib/completion/bash/docker +++ b/components/cli/contrib/completion/bash/docker @@ -1220,14 +1220,18 @@ _docker_config_create() { --label|-l) return ;; + --template-driver) + COMPREPLY=( $( compgen -W "golang" -- "$cur" ) ) + return + ;; esac case "$cur" in -*) - COMPREPLY=( $( compgen -W "--help --label -l" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "--help --label -l --template-driver" -- "$cur" ) ) ;; *) - local counter=$(__docker_pos_first_nonflag '--label|-l') + local counter=$(__docker_pos_first_nonflag '--label|-l|--template-driver') if [ "$cword" -eq "$((counter + 1))" ]; then _filedir fi @@ -4238,14 +4242,18 @@ _docker_secret_create() { --driver|-d|--label|-l) return ;; + --template-driver) + COMPREPLY=( $( compgen -W "golang" -- "$cur" ) ) + return + ;; esac case "$cur" in -*) - COMPREPLY=( $( compgen -W "--driver -d --help --label -l" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "--driver -d --help --label -l --template-driver" -- "$cur" ) ) ;; *) - local counter=$(__docker_pos_first_nonflag '--driver|-d|--label|-l') + local counter=$(__docker_pos_first_nonflag '--driver|-d|--label|-l|--template-driver') if [ "$cword" -eq "$((counter + 1))" ]; then _filedir fi