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>
This commit is contained in:
Sebastiaan van Stijn 2022-03-30 12:42:26 +02:00
parent 7d4ae13753
commit b87a0c1b03
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 12 additions and 12 deletions

View File

@ -326,7 +326,7 @@ project contains multiple Dockerfiles that 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 .
@ -346,7 +346,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 .
@ -393,17 +393,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
@ -441,13 +441,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
@ -463,7 +463,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
@ -471,7 +471,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
@ -489,7 +489,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
@ -582,7 +582,7 @@ vndr
> [enable BuildKit](../builder.md#buildkit) or 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.
@ -625,7 +625,7 @@ $ docker build --cache-from myname/myapp .
> 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