Skip to content

Commit 4ef5b48

Browse files
authored
Merge pull request #16460 from thaJeztah/engine_reference_updates
engine: update reference docs to use new anchor tags
2 parents 1f4f22c + a7b9985 commit 4ef5b48

File tree

69 files changed

+646
-611
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+646
-611
lines changed

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,11 @@ EOT
6666
# htmlproofer checks for broken links
6767
FROM gem AS htmlproofer-base
6868
# FIXME(thaJeztah): remove temporary exclusion rule for buildx_build once anchor links are updated.
69-
# FIXME(thaJeztah): remove temporary exclusion rule for commandline/cli once https://github.com/docker/cli/pull/3525 is merged.
7069
RUN --mount=type=bind,from=generate,source=/out,target=_site <<EOF
7170
htmlproofer ./_site \
7271
--disable-external \
7372
--internal-domains="docs.docker.com,docs-stage.docker.com,localhost:4000" \
74-
--file-ignore="/^./_site/engine/api/.*$/,./_site/registry/configuration/index.html,./_site/engine/reference/commandline/buildx_build/index.html,./_site/engine/reference/commandline/cli/index.html" \
73+
--file-ignore="/^./_site/engine/api/.*$/,./_site/registry/configuration/index.html,./_site/engine/reference/commandline/buildx_build/index.html" \
7574
--url-ignore="/^/docker-hub/api/latest/.*$/,/^/engine/api/v.+/#.*$/,/^/glossary/.*$/" > /results 2>&1
7675
rc=$?
7776
if [[ $rc -eq 0 ]]; then

_data/engine-cli/docker_attach.yaml

Lines changed: 59 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ long: |-
2626
> so.
2727
2828
It is forbidden to redirect the standard input of a `docker attach` command
29-
while attaching to a tty-enabled container (i.e.: launched with `-t`).
29+
while attaching to a TTY-enabled container (using the `-i` and `-t` options).
3030
31-
While a client is connected to container's stdio using `docker attach`, Docker
32-
uses a ~1MB memory buffer to maximize the throughput of the application. If
33-
this buffer is filled, the speed of the API connection will start to have an
34-
effect on the process output writing speed. This is similar to other
31+
While a client is connected to container's `stdio` using `docker attach`, Docker
32+
uses a ~1MB memory buffer to maximize the throughput of the application.
33+
Once this buffer is full, the speed of the API connection is affected, and so
34+
this impacts the output process' writing speed. This is similar to other
3535
applications like SSH. Because of this, it is not recommended to run
3636
performance critical applications that generate a lot of output in the
3737
foreground over a slow client connection. Instead, users should use the
@@ -93,45 +93,68 @@ options:
9393
examples: |-
9494
### Attach to and detach from a running container
9595
96+
The following example starts an ubuntu container running `top` in detached mode,
97+
then attaches to the container;
98+
9699
```console
97-
$ docker run -d --name topdemo ubuntu /usr/bin/top -b
100+
$ docker run -d --name topdemo ubuntu:22.04 /usr/bin/top -b
98101
99102
$ docker attach topdemo
100103
101-
top - 02:05:52 up 3:05, 0 users, load average: 0.01, 0.02, 0.05
104+
top - 12:27:44 up 3 days, 21:54, 0 users, load average: 0.00, 0.00, 0.00
102105
Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
103-
Cpu(s): 0.1%us, 0.2%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
104-
Mem: 373572k total, 355560k used, 18012k free, 27872k buffers
105-
Swap: 786428k total, 0k used, 786428k free, 221740k cached
106+
%Cpu(s): 0.1 us, 0.1 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
107+
MiB Mem : 3934.3 total, 770.1 free, 674.2 used, 2490.1 buff/cache
108+
MiB Swap: 1024.0 total, 839.3 free, 184.7 used. 2814.0 avail Mem
109+
110+
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
111+
1 root 20 0 7180 2896 2568 R 0.0 0.1 0:00.02 top
112+
```
106113
107-
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
108-
1 root 20 0 17200 1116 912 R 0 0.3 0:00.03 top
114+
As the container was started without the `-i`, and `-t` options, signals are
115+
forwarded to the attached process, which means that the default `CTRL-p CTRL-q`
116+
detach key sequence produces no effect, but pressing `CTRL-c` terminates the
117+
container:
109118
110-
top - 02:05:55 up 3:05, 0 users, load average: 0.01, 0.02, 0.05
111-
Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
112-
Cpu(s): 0.0%us, 0.2%sy, 0.0%ni, 99.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
113-
Mem: 373572k total, 355244k used, 18328k free, 27872k buffers
114-
Swap: 786428k total, 0k used, 786428k free, 221776k cached
119+
```console
120+
<...>
121+
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
122+
1 root 20 0 7180 2896 2568 R 0.0 0.1 0:00.02 top^P^Q
123+
^C
115124
116-
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
117-
1 root 20 0 17208 1144 932 R 0 0.3 0:00.03 top
125+
$ docker ps -a --filter name=topdemo
118126
127+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
128+
4cf0d0ebb079 ubuntu:22.04 "/usr/bin/top -b" About a minute ago Exited (0) About a minute ago topdemo
129+
```
119130
120-
top - 02:05:58 up 3:06, 0 users, load average: 0.01, 0.02, 0.05
121-
Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
122-
Cpu(s): 0.2%us, 0.3%sy, 0.0%ni, 99.5%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
123-
Mem: 373572k total, 355780k used, 17792k free, 27880k buffers
124-
Swap: 786428k total, 0k used, 786428k free, 221776k cached
131+
Repeating the example above, but this time with the `-i` and `-t` options set;
125132
126-
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
127-
1 root 20 0 17208 1144 932 R 0 0.3 0:00.03 top
128-
^C$
133+
```console
134+
$ docker run -dit --name topdemo2 ubuntu:22.04 /usr/bin/top -b
135+
```
129136
130-
$ echo $?
131-
0
132-
$ docker ps -a | grep topdemo
137+
Now, when attaching to the container, and pressing the `CTRL-p CTRL-q` ("read
138+
escape sequence"), the Docker CLI is handling the detach sequence, and the
139+
`attach` command is detached from the container. Checking the container's status
140+
with `docker ps` shows that the container is still running in the background:
133141
134-
7998ac8581f9 ubuntu:14.04 "/usr/bin/top -b" 38 seconds ago Exited (0) 21 seconds ago topdemo
142+
```console
143+
$ docker attach topdemo2
144+
145+
top - 12:44:32 up 3 days, 22:11, 0 users, load average: 0.00, 0.00, 0.00
146+
Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
147+
%Cpu(s): 50.0 us, 0.0 sy, 0.0 ni, 50.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
148+
MiB Mem : 3934.3 total, 770.6 free, 672.4 used, 2491.4 buff/cache
149+
MiB Swap: 1024.0 total, 839.3 free, 184.7 used. 2815.8 avail Mem
150+
151+
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
152+
1 root 20 0 7180 2776 2452 R 0.0 0.1 0:00.02 topread escape sequence
153+
154+
$ docker ps -a --filter name=topdemo2
155+
156+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
157+
b1661dce0fc2 ubuntu:22.04 "/usr/bin/top -b" 2 minutes ago Up 2 minutes topdemo2
135158
```
136159
137160
### Get the exit code of the container's command
@@ -140,20 +163,19 @@ examples: |-
140163
process is returned by the `docker attach` command to its caller too:
141164
142165
```console
143-
$ docker run --name test -d -it debian
166+
$ docker run --name test -dit alpine
144167
275c44472aebd77c926d4527885bb09f2f6db21d878c75f0a1c212c03d3bcfab
145168
146169
$ docker attach test
147-
root@f38c87f2a42d:/# exit 13
148-
149-
exit
170+
/# exit 13
150171
151172
$ echo $?
152173
13
153174
154-
$ docker ps -a | grep test
175+
$ docker ps -a --filter name=test
155176
156-
275c44472aeb debian:7 "/bin/bash" 26 seconds ago Exited (13) 17 seconds ago test
177+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
178+
a2fe3fd886db alpine "/bin/sh" About a minute ago Exited (13) 40 seconds ago test
157179
```
158180
deprecated: false
159181
experimental: false

_data/engine-cli/docker_build.yaml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ examples: |-
570570
expect to ignore different sets of files.
571571
572572
573-
### Tag an image (-t)
573+
### <a name="tag"></a> Tag an image (-t, --tag)
574574
575575
```console
576576
$ docker build -t vieux/apache:2.0 .
@@ -590,7 +590,7 @@ examples: |-
590590
$ docker build -t whenry/fedora-jboss:latest -t whenry/fedora-jboss:v2.1 .
591591
```
592592
593-
### Specify a Dockerfile (-f)
593+
### <a name="file"></a> Specify a Dockerfile (-f, --file)
594594
595595
```console
596596
$ docker build -f Dockerfile.debug .
@@ -637,17 +637,17 @@ examples: |-
637637
> repeatable builds on remote Docker hosts. This is also the reason why
638638
> `ADD ../file` does not work.
639639
640-
### Use a custom parent cgroup (--cgroup-parent)
640+
### <a name="cgroup-parent"></a> Use a custom parent cgroup (--cgroup-parent)
641641
642642
When `docker build` is run with the `--cgroup-parent` option the containers
643643
used in the build will be run with the [corresponding `docker run` flag](../run.md#specify-custom-cgroups).
644644
645-
### Set ulimits in container (--ulimit)
645+
### <a name="ulimit"></a> Set ulimits in container (--ulimit)
646646
647647
Using the `--ulimit` option with `docker build` will cause each build step's
648-
container to be started using those [`--ulimit` flag values](run.md#set-ulimits-in-container---ulimit).
648+
container to be started using those [`--ulimit` flag values](run.md#ulimit).
649649
650-
### Set build-time variables (--build-arg)
650+
### <a name="build-arg"></a> Set build-time variables (--build-arg)
651651
652652
You can use `ENV` instructions in a Dockerfile to define variable
653653
values. These values persist in the built image. However, often
@@ -682,16 +682,16 @@ examples: |-
682682
$ docker build --build-arg HTTP_PROXY .
683683
```
684684
685-
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)
685+
This is similar to how `docker run -e` works. Refer to the [`docker run` documentation](run.md#env)
686686
for more information.
687687
688-
### Optional security options (--security-opt)
688+
### <a name="security-opt"></a> Optional security options (--security-opt)
689689
690690
This flag is only supported on a daemon running on Windows, and only supports
691691
the `credentialspec` option. The `credentialspec` must be in the format
692692
`file://spec.txt` or `registry://keyname`.
693693
694-
### Specify isolation technology for container (--isolation)
694+
### <a name="isolation"></a> Specify isolation technology for container (--isolation)
695695
696696
This option is useful in situations where you are running Docker containers on
697697
Windows. The `--isolation=<value>` option sets a container's isolation
@@ -707,15 +707,15 @@ examples: |-
707707
708708
Specifying the `--isolation` flag without a value is the same as setting `--isolation="default"`.
709709
710-
### Add entries to container hosts file (--add-host)
710+
### <a name="add-host"></a> Add entries to container hosts file (--add-host)
711711
712712
You can add other hosts into a container's `/etc/hosts` file by using one or
713713
more `--add-host` flags. This example adds a static address for a host named
714714
`docker`:
715715
716716
$ docker build --add-host=docker:10.180.0.1 .
717717
718-
### Specifying target build stage (--target)
718+
### <a name="target"></a> Specifying target build stage (--target)
719719
720720
When building a Dockerfile with multiple build stages, `--target` can be used to
721721
specify an intermediate build stage by name as a final stage for the resulting
@@ -733,7 +733,14 @@ examples: |-
733733
$ docker build -t mybuildimage --target build-env .
734734
```
735735
736-
### Custom build outputs
736+
### <a name="output"></a> Custom build outputs (--output)
737+
738+
> **Note**
739+
>
740+
> This feature requires the BuildKit backend. You can either
741+
> [enable BuildKit](https://docs.docker.com/build/buildkit/#getting-started) or
742+
> use the [buildx](https://github.com/docker/buildx) plugin which provides more
743+
> output type options.
737744
738745
By default, a local container image is created from the build result. The
739746
`--output` (or `-o`) flag allows you to override this behavior, and a specify a
@@ -820,14 +827,14 @@ examples: |-
820827
vndr
821828
```
822829
830+
### <a name="cache-from"></a> Specifying external cache sources (--cache-from)
831+
823832
> **Note**
824833
>
825834
> This feature requires the BuildKit backend. You can either
826835
> [enable BuildKit](https://docs.docker.com/build/buildkit/#getting-started) or
827-
> use the [buildx](https://github.com/docker/buildx) plugin which provides more
828-
> output type options.
829-
830-
### Specifying external cache sources
836+
> use the [buildx](https://github.com/docker/buildx) plugin. The previous
837+
> builder has limited support for reusing cache from pre-pulled images.
831838
832839
In addition to local build cache, the builder can reuse the cache generated from
833840
previous builds with the `--cache-from` flag pointing to an image in the registry.
@@ -863,14 +870,7 @@ examples: |-
863870
$ docker build --cache-from myname/myapp .
864871
```
865872
866-
> **Note**
867-
>
868-
> This feature requires the BuildKit backend. You can either
869-
> [enable BuildKit](https://docs.docker.com/build/buildkit/#getting-started) or
870-
> use the [buildx](https://github.com/docker/buildx) plugin. The previous
871-
> builder has limited support for reusing cache from pre-pulled images.
872-
873-
### Squash an image's layers (--squash) (experimental)
873+
### <a name="squash"></a> Squash an image's layers (--squash) (experimental)
874874
875875
#### Overview
876876

_data/engine-cli/docker_commit.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ examples: |-
6666
$ docker ps
6767
6868
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
69-
c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
70-
197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
69+
c3f279d17e0a ubuntu:22.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
70+
197387f1b436 ubuntu:22.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
7171
7272
$ docker commit c3f279d17e0a svendowideit/testimage:version3
7373
@@ -79,14 +79,14 @@ examples: |-
7979
svendowideit/testimage version3 f5283438590d 16 seconds ago 335.7 MB
8080
```
8181
82-
### Commit a container with new configurations
82+
### <a name="change"></a> Commit a container with new configurations (--change)
8383
8484
```console
8585
$ docker ps
8686
8787
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
88-
c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
89-
197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
88+
c3f279d17e0a ubuntu:22.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
89+
197387f1b436 ubuntu:22.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
9090
9191
$ docker inspect -f "{{ .Config.Env }}" c3f279d17e0a
9292
@@ -107,8 +107,8 @@ examples: |-
107107
$ docker ps
108108
109109
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
110-
c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
111-
197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
110+
c3f279d17e0a ubuntu:22.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
111+
197387f1b436 ubuntu:22.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
112112
113113
$ docker commit --change='CMD ["apachectl", "-DFOREGROUND"]' -c "EXPOSE 80" c3f279d17e0a svendowideit/testimage:version4
114114
@@ -122,8 +122,8 @@ examples: |-
122122
123123
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
124124
89373736e2e7 testimage:version4 "apachectl -DFOREGROU" 3 seconds ago Up 2 seconds 80/tcp distracted_fermat
125-
c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
126-
197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
125+
c3f279d17e0a ubuntu:22.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
126+
197387f1b436 ubuntu:22.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
127127
```
128128
deprecated: false
129129
experimental: false

_data/engine-cli/docker_config_create.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ examples: |-
6060
dg426haahpi5ezmkkj5kyl3sn my_config 7 seconds ago 7 seconds ago
6161
```
6262
63-
### Create a config with labels
63+
### <a name="label"></a> Create a config with labels (-l, --label)
6464
6565
```console
6666
$ docker config create \

_data/engine-cli/docker_config_inspect.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ examples: |-
8080
]
8181
```
8282
83-
### Formatting
83+
### <a name="format"></a> Format the output (--format)
8484
8585
You can use the --format option to obtain specific information about a
8686
config. The following example command outputs the creation time of the

_data/engine-cli/docker_config_ls.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ examples: |-
5353
mem02h8n73mybpgqjf0kfi1n0 test_config 3 seconds ago 3 seconds ago
5454
```
5555
56-
### Filtering
56+
### <a name="filter"></a> Filtering (-f, --filter)
5757
5858
The filtering flag (`-f` or `--filter`) format is a `key=value` pair. If there is more
5959
than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`)
@@ -113,7 +113,7 @@ examples: |-
113113
mem02h8n73mybpgqjf0kfi1n0 test_config About an hour ago About an hour ago
114114
```
115115
116-
### Format the output
116+
### <a name="format"></a> Format the output (--format)
117117
118118
The formatting option (`--format`) pretty prints configs output
119119
using a Go template.

_data/engine-cli/docker_container_prune.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ examples: |-
3737
Total reclaimed space: 212 B
3838
```
3939
40-
### Filtering
40+
### <a name="filter"></a> Filtering (--filter)
4141
4242
The filtering flag (`--filter`) format is of "key=value". If there is more
4343
than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`)

_data/engine-cli/docker_context_create.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ examples: |-
6565
my-context
6666
```
6767
68-
### Create a context based on an existing context
68+
### <a name="from"></a> Create a context based on an existing context (--from)
6969
7070
Use the `--from=<context-name>` option to create a new context from
7171
an existing context. The example below creates a new context named `my-context`

_data/engine-cli/docker_cp.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ examples: |-
111111
### Corner cases
112112
113113
It is not possible to copy certain system files such as resources under
114-
`/proc`, `/sys`, `/dev`, [tmpfs](run.md#mount-tmpfs---tmpfs), and mounts created by
114+
`/proc`, `/sys`, `/dev`, [tmpfs](run.md#tmpfs), and mounts created by
115115
the user in the container. However, you can still copy such files by manually
116116
running `tar` in `docker exec`. Both of the following examples do the same thing
117117
in different ways (consider `SRC_PATH` and `DEST_PATH` are directories):

0 commit comments

Comments
 (0)