diff --git a/data/cli/engine/docker_config_ls.yaml b/data/cli/engine/docker_config_ls.yaml index bb5842cdbd67..8559f7c5bdc4 100644 --- a/data/cli/engine/docker_config_ls.yaml +++ b/data/cli/engine/docker_config_ls.yaml @@ -115,7 +115,7 @@ examples: |- `project-a` value. ```console - $ docker service ls --filter label=project=test + $ docker config ls --filter label=project=project-a ID NAME CREATED UPDATED mem02h8n73mybpgqjf0kfi1n0 test_config About an hour ago About an hour ago @@ -128,7 +128,7 @@ examples: |- The following filter matches config with a name containing a prefix of `test`. ```console - $ docker config ls --filter name=test_config + $ docker config ls --filter name=test ID NAME CREATED UPDATED mem02h8n73mybpgqjf0kfi1n0 test_config About an hour ago About an hour ago diff --git a/data/cli/engine/docker_container_cp.yaml b/data/cli/engine/docker_container_cp.yaml index 3dd4181795fe..5ff5b80eddbd 100644 --- a/data/cli/engine/docker_container_cp.yaml +++ b/data/cli/engine/docker_container_cp.yaml @@ -86,7 +86,7 @@ options: shorthand: L value_type: bool default_value: "false" - description: Always follow symbol link in SRC_PATH + description: Always follow symlinks in SRC_PATH deprecated: false hidden: false experimental: false diff --git a/data/cli/engine/docker_container_ls.yaml b/data/cli/engine/docker_container_ls.yaml index e61f3fd39528..24648b6f9400 100644 --- a/data/cli/engine/docker_container_ls.yaml +++ b/data/cli/engine/docker_container_ls.yaml @@ -216,7 +216,7 @@ examples: |- 9b6247364a03 busybox "top" 2 minutes ago Up 2 minutes nostalgic_stallman ``` - You can also filter for a substring in a name as this shows: + You can filter for a substring in a name as this shows: ```console $ docker ps --filter "name=nostalgic" @@ -483,22 +483,23 @@ examples: |- Valid placeholders for the Go template are listed below: - | Placeholder | Description | - |:--------------|:------------------------------------------------------------------------------------------------| - | `.ID` | Container ID | - | `.Image` | Image ID | - | `.Command` | Quoted command | - | `.CreatedAt` | Time when the container was created. | - | `.RunningFor` | Elapsed time since the container was started. | - | `.Ports` | Exposed ports. | - | `.State` | Container status (for example; "created", "running", "exited"). | - | `.Status` | Container status with details about duration and health-status. | - | `.Size` | Container disk size. | - | `.Names` | Container names. | - | `.Labels` | All labels assigned to the container. | - | `.Label` | Value of a specific label for this container. For example `'{{.Label "com.docker.swarm.cpu"}}'` | - | `.Mounts` | Names of the volumes mounted in this container. | - | `.Networks` | Names of the networks attached to this container. | + | Placeholder | Description | + |:----------------|:------------------------------------------------------------------------------------------------| + | `.ID` | Container ID | + | `.Image` | Image ID | + | `.Command` | Quoted command | + | `.CreatedAt` | Time when the container was created. | + | `.RunningFor` | Elapsed time since the container was started. | + | `.Ports` | Exposed ports. | + | `.State` | Container status (for example; "created", "running", "exited"). | + | `.Status` | Container status with details about duration and health-status. | + | `.HealthStatus` | Container health status ("starting", "healthy", "unhealthy"; empty when unavailable). | + | `.Size` | Container disk size. | + | `.Names` | Container names. | + | `.Labels` | All labels assigned to the container. | + | `.Label` | Value of a specific label for this container. For example `'{{.Label "com.docker.swarm.cpu"}}'` | + | `.Mounts` | Names of the volumes mounted in this container. | + | `.Networks` | Names of the networks attached to this container. | When using the `--format` option, the `ps` command will either output the data exactly as the template declares or, when using the `table` directive, includes diff --git a/data/cli/engine/docker_container_run.yaml b/data/cli/engine/docker_container_run.yaml index f49e12e13bb7..1d8363edbf47 100644 --- a/data/cli/engine/docker_container_run.yaml +++ b/data/cli/engine/docker_container_run.yaml @@ -2215,7 +2215,7 @@ examples: |- `--rm` flag: ```text - --rm: Automatically remove the container when it exits + --rm: Automatically remove the container and its associated anonymous volumes when it exits ``` > [!NOTE] diff --git a/data/cli/engine/docker_context_use.yaml b/data/cli/engine/docker_context_use.yaml index 5ab7f8175096..c169a483ed70 100644 --- a/data/cli/engine/docker_context_use.yaml +++ b/data/cli/engine/docker_context_use.yaml @@ -1,9 +1,14 @@ command: docker context use -short: Set the current docker context +short: Set the default docker context long: |- - Set the default context to use, when `DOCKER_HOST`, `DOCKER_CONTEXT` environment - variables and `--host`, `--context` global options aren't set. - To disable usage of contexts, you can use the special `default` context. + The `docker context use` command sets the default context for the Docker CLI. + + The `docker context use` command sets the Docker CLI’s default context by updating + your CLI config (`~/.docker/config.json`). This change is persistent, affecting + all shells and sessions that share that config, not just the current terminal. + + For one-off commands or per-shell usage, use `--context` or the `DOCKER_CONTEXT` + environment variable instead. usage: docker context use CONTEXT pname: docker context plink: docker_context.yaml @@ -18,6 +23,49 @@ inherited_options: experimentalcli: false kubernetes: false swarm: false +examples: |- + ### Set the default (sticky) context + + This updates the CLI configuration and applies to new terminal sessions: + + ```bash + $ docker context use my-context + my-context + + $ docker context show + my-context + ``` + + ### Use a context for a single command + + Use the global `--context` flag to avoid changing the default: + + ```bash + $ docker --context my-context ps + ``` + + ### Use a context for the current shell session + + Set `DOCKER_CONTEXT` to override the configured default in the current shell: + + ```bash + $ export DOCKER_CONTEXT=my-context + $ docker context show + my-context + ``` + + To stop overriding: + + ```bash + $ unset DOCKER_CONTEXT + ``` + + ### Switch back to the default context + + ```bash + $ docker context use default + default + ``` deprecated: false hidden: false experimental: false diff --git a/data/cli/engine/docker_cp.yaml b/data/cli/engine/docker_cp.yaml index d702c8d0fb15..f69bfd0dcea2 100644 --- a/data/cli/engine/docker_cp.yaml +++ b/data/cli/engine/docker_cp.yaml @@ -29,7 +29,7 @@ options: shorthand: L value_type: bool default_value: "false" - description: Always follow symbol link in SRC_PATH + description: Always follow symlinks in SRC_PATH deprecated: false hidden: false experimental: false diff --git a/data/cli/engine/docker_image_build.yaml b/data/cli/engine/docker_image_build.yaml index d924416a59fb..09accf261784 100644 --- a/data/cli/engine/docker_image_build.yaml +++ b/data/cli/engine/docker_image_build.yaml @@ -69,7 +69,7 @@ long: |- ``` BuildKit on the other hand strips leading relative paths that traverse outside - of the build context. Re-using the previous example, the path `COPY + of the build context. Reusing the previous example, the path `COPY ../../some-dir .` evaluates to `COPY some-dir .` with BuildKit. usage: docker image build [OPTIONS] PATH | URL | - pname: docker image diff --git a/data/cli/engine/docker_image_pull.yaml b/data/cli/engine/docker_image_pull.yaml index 7f43742be118..d1dda47d76d5 100644 --- a/data/cli/engine/docker_image_pull.yaml +++ b/data/cli/engine/docker_image_pull.yaml @@ -14,13 +14,13 @@ long: |- ### Proxy configuration If you are behind an HTTP proxy server, for example in corporate settings, - before open a connect to registry, you may need to configure the Docker - daemon's proxy settings, refer to the [dockerd command-line reference](/reference/cli/dockerd/#proxy-configuration) - for details. + you may have to configure the Docker daemon to use the proxy server for + operations such as pulling and pushing images. Refer to the + [dockerd command-line reference](/reference/cli/dockerd/#proxy-configuration) for details. ### Concurrent downloads - By default the Docker daemon will pull three layers of an image at a time. + By default the Docker daemon downloads three layers of an image at a time. If you are on a low bandwidth connection this may cause timeout issues and you may want to lower this via the `--max-concurrent-downloads` daemon option. See the [daemon documentation](/reference/cli/dockerd/) for more details. diff --git a/data/cli/engine/docker_inspect.yaml b/data/cli/engine/docker_inspect.yaml index 1fe0daebfca9..f750741bf5f5 100644 --- a/data/cli/engine/docker_inspect.yaml +++ b/data/cli/engine/docker_inspect.yaml @@ -142,7 +142,7 @@ examples: |- You can loop over arrays and maps in the results to produce simple text output: ```console - $ docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' $INSTANCE_ID + $ docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} {{$p}} -> {{with $conf}}{{(index . 0).HostPort}}{{else}}none{{end}} {{end}}' $INSTANCE_ID ``` ### Find a specific port mapping diff --git a/data/cli/engine/docker_secret_ls.yaml b/data/cli/engine/docker_secret_ls.yaml index f31cd265b7b2..ce75105f05a1 100644 --- a/data/cli/engine/docker_secret_ls.yaml +++ b/data/cli/engine/docker_secret_ls.yaml @@ -115,7 +115,7 @@ examples: |- `project-a` value. ```console - $ docker service ls --filter label=project=test + $ docker secret ls --filter label=project=project-a ID NAME CREATED UPDATED mem02h8n73mybpgqjf0kfi1n0 test_secret About an hour ago About an hour ago @@ -128,7 +128,7 @@ examples: |- The following filter matches secret with a name containing a prefix of `test`. ```console - $ docker secret ls --filter name=test_secret + $ docker secret ls --filter name=test ID NAME CREATED UPDATED mem02h8n73mybpgqjf0kfi1n0 test_secret About an hour ago About an hour ago diff --git a/data/cli/engine/docker_swarm_ca.yaml b/data/cli/engine/docker_swarm_ca.yaml index feaa95d8334a..a7fdad254c04 100644 --- a/data/cli/engine/docker_swarm_ca.yaml +++ b/data/cli/engine/docker_swarm_ca.yaml @@ -126,7 +126,7 @@ examples: |- rotated CA certificates: [> ] 0/2 nodes ``` - Once the rotation os finished (all the progress bars have completed) the now-current + Once the rotation is finished (all the progress bars have completed) the now-current CA certificate will be printed: ```console