docs: build: add named anchor tags for flags

With this, the sections are linked from the "options" table when
producing the documentation on docs.docker.com

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b87a0c1b03)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-03-30 12:42:26 +02:00
parent d6d4612bcc
commit 6bc0539acb
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 12 additions and 12 deletions

View File

@ -332,7 +332,7 @@ found, the `.dockerignore` file is used if present. Using a Dockerfile based
expect to ignore different sets of files.
### Tag an image (-t)
### <a name=tag></a> Tag an image (-t, --tag)
```console
$ docker build -t vieux/apache:2.0 .
@ -352,7 +352,7 @@ For example, to tag an image both as `whenry/fedora-jboss:latest` and
$ docker build -t whenry/fedora-jboss:latest -t whenry/fedora-jboss:v2.1 .
```
### Specify a Dockerfile (-f)
### <a name=file></a> Specify a Dockerfile (-f, --file)
```console
$ docker build -f Dockerfile.debug .
@ -399,17 +399,17 @@ the command line.
> repeatable builds on remote Docker hosts. This is also the reason why
> `ADD ../file` does not work.
### Use a custom parent cgroup (--cgroup-parent)
### <a name=cgroup-parent></a> Use a custom parent cgroup (--cgroup-parent)
When `docker build` is run with the `--cgroup-parent` option the containers
used in the build will be run with the [corresponding `docker run` flag](../run.md#specify-custom-cgroups).
### Set ulimits in container (--ulimit)
### <a name=ulimit></a> Set ulimits in container (--ulimit)
Using the `--ulimit` option with `docker build` will cause each build step's
container to be started using those [`--ulimit` flag values](run.md#set-ulimits-in-container---ulimit).
### Set build-time variables (--build-arg)
### <a name=build-arg></a> Set build-time variables (--build-arg)
You can use `ENV` instructions in a Dockerfile to define variable
values. These values persist in the built image. However, often
@ -447,13 +447,13 @@ $ 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)
### <a name=security-opt></a> Optional security options (--security-opt)
This flag is only supported on a daemon running on Windows, and only supports
the `credentialspec` option. The `credentialspec` must be in the format
`file://spec.txt` or `registry://keyname`.
### Specify isolation technology for container (--isolation)
### <a name=isolation></a> Specify isolation technology for container (--isolation)
This option is useful in situations where you are running Docker containers on
Windows. The `--isolation=<value>` option sets a container's isolation
@ -469,7 +469,7 @@ Linux namespaces. On Microsoft Windows, you can specify these values:
Specifying the `--isolation` flag without a value is the same as setting `--isolation="default"`.
### Add entries to container hosts file (--add-host)
### <a name=add-host></a> Add entries to container hosts file (--add-host)
You can add other hosts into a container's `/etc/hosts` file by using one or
more `--add-host` flags. This example adds a static address for a host named
@ -477,7 +477,7 @@ more `--add-host` flags. This example adds a static address for a host named
$ docker build --add-host=docker:10.180.0.1 .
### Specifying target build stage (--target)
### <a name=target></a> Specifying target build stage (--target)
When building a Dockerfile with multiple build stages, `--target` can be used to
specify an intermediate build stage by name as a final stage for the resulting
@ -495,7 +495,7 @@ FROM alpine AS production-env
$ docker build -t mybuildimage --target build-env .
```
### Custom build outputs
### <a name=output></a> Custom build outputs (--output)
By default, a local container image is created from the build result. The
`--output` (or `-o`) flag allows you to override this behavior, and a specify a
@ -589,7 +589,7 @@ vndr
> use the [buildx](https://github.com/docker/buildx) plugin which provides more
> output type options.
### Specifying external cache sources
### <a name=cache-from></a> Specifying external cache sources (--cache-from)
In addition to local build cache, the builder can reuse the cache generated from
previous builds with the `--cache-from` flag pointing to an image in the registry.
@ -632,7 +632,7 @@ $ docker build --cache-from myname/myapp .
> use the [buildx](https://github.com/docker/buildx) plugin. The previous
> builder has limited support for reusing cache from pre-pulled images.
### Squash an image's layers (--squash) (experimental)
### <a name=squash></a> Squash an image's layers (--squash) (experimental)
#### Overview