Skip to content

Commit e684723

Browse files
docs(compose): Inlude example for build secrets on the use-secrets doc (docker#20403)
* docs: Inlude example for build secrets * Apply suggestions from code review --------- Co-authored-by: Allie Sadler <102604716+aevesdocker@users.noreply.github.com>
1 parent bfd8501 commit e684723

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

content/compose/use-secrets.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,25 @@ In the advanced example above:
8484
>
8585
> The `_FILE` environment variables demonstrated here are a convention used by some images, including Docker Official Images like [mysql](https://hub.docker.com/_/mysql) and [postgres](https://hub.docker.com/_/postgres).
8686

87+
### Build secrets
88+
89+
In the following example, the `npm_token` secret is made available at build time. It's value is taken from the `NPM_TOKEN` environment variable.
90+
91+
```yaml
92+
services:
93+
myapp:
94+
build:
95+
secrets:
96+
- npm_token
97+
context: .
98+
99+
secrets:
100+
npm_token:
101+
environment: NPM_TOKEN
102+
```
103+
87104
## Resources
88105

89106
- [Secrets top-level element](compose-file/09-secrets.md)
90107
- [Secrets attribute for services top-level element](compose-file/05-services.md#secrets)
108+
- [Build secrets](https://docs.docker.com/build/building/secrets/)

0 commit comments

Comments
 (0)