Docker CLI
Build secret input
Supplies a file input separately from the normal build context. Use synthetic data only here, with the source excluded from COPY context. Use no-cache for the positive synthetic exercise to require execution.
Formal Syntax & Structure
docker syntaxdocker
docker build --secret id=<id>,src=<file> [OPTIONS] PATHParameters & Attributes
| Name | Type | Description |
|---|---|---|
| id | string | Mount identifier. |
| src | string | Path to reviewed synthetic file. |
| PATH | string | Build context. |
Working Example
Example Snippetdocker
docker build --no-cache --load --network none --secret id=demo,src=demo.txt -t bm-v09-build-secrets:lab .