Merge pull request #19609 from dvdksn/fix-build-secrets-example

build: fix secret mount erroneous example
This commit is contained in:
David Karlsson 2024-03-13 09:12:49 +01:00 committed by GitHub
commit 7155a1de4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 4 deletions

View File

@ -61,17 +61,20 @@ The source of a secret can be either a
When you use the CLI or Bake, the type can be detected automatically. You can When you use the CLI or Bake, the type can be detected automatically. You can
also specify it explicitly with `type=file` or `type=env`. also specify it explicitly with `type=file` or `type=env`.
The following example mounts the environment variable `KUBECONFIG` to secret ID The following example mounts the environment variable `KUBECONFIG` to secret ID `kube`,
`kube`. as a file in the build container at `/run/secrets/kube`.
```console ```console
$ docker build --secret id=kube,env=KUBECONFIG . $ docker build --secret id=kube,env=KUBECONFIG .
``` ```
The following example maps an environment variable directly to a secret ID. When you secrets from environment variables, you can omit the `id` parameter
to bind the secret to a file with the same name as the variable.
In the following example, the value of the `API_TOKEN` variable
is mounted to `/run/secrets/API_TOKEN` in the build container.
```console ```console
$ docker build --secret env=KUBECONFIG . $ docker build --secret id=API_TOKEN .
``` ```
### Target ### Target