Skip to content

Commit 7a724ac

Browse files
committed
docs: minor cli reference editorial updates
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
1 parent 55e164a commit 7a724ac

14 files changed

+133
-150
lines changed

docs/reference/buildx.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# buildx
22

3-
```
3+
```text
44
docker buildx [OPTIONS] COMMAND
55
```
66

docs/reference/buildx_bake.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# buildx bake
22

3-
```
3+
```text
44
docker buildx bake [OPTIONS] [TARGET...]
55
```
66

@@ -33,7 +33,7 @@ Build from a file
3333

3434
## Description
3535

36-
Bake is a high-level build command. Each specified target will run in parallel
36+
Bake is a high-level build command. Each specified target runs in parallel
3737
as part of the build.
3838

3939
Read [High-level build options with Bake](https://docs.docker.com/build/bake/)
@@ -54,8 +54,8 @@ Same as [`buildx --builder`](buildx.md#builder).
5454
### <a name="file"></a> Specify a build definition file (-f, --file)
5555

5656
Use the `-f` / `--file` option to specify the build definition file to use.
57-
The file can be an HCL, JSON or Compose file. If multiple files are specified
58-
they are all read and configurations are combined.
57+
The file can be an HCL, JSON or Compose file. If multiple files are specified,
58+
all are read and the build configurations are combined.
5959

6060
You can pass the names of the targets to build, to build only specific target(s).
6161
The following example builds the `db` and `webapp-release` targets that are
@@ -90,9 +90,9 @@ $ docker buildx bake -f docker-bake.dev.hcl db webapp-release
9090
See the [Bake file reference](https://docs.docker.com/build/bake/reference/)
9191
for more details.
9292

93-
### <a name="no-cache"></a> Do not use cache when building the image (--no-cache)
93+
### <a name="no-cache"></a> Don't use cache when building the image (--no-cache)
9494

95-
Same as `build --no-cache`. Do not use cache when building the image.
95+
Same as `build --no-cache`. Don't use cache when building the image.
9696

9797
### <a name="print"></a> Print the options without building (--print)
9898

@@ -154,7 +154,7 @@ $ docker buildx bake --set *.platform=linux/arm64 # overrides platform for a
154154
$ docker buildx bake --set foo*.no-cache # bypass caching only for targets starting with 'foo'
155155
```
156156

157-
Complete list of overridable fields:
157+
You can override the following fields:
158158

159159
* `args`
160160
* `cache-from`

docs/reference/buildx_build.md

Lines changed: 54 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# buildx build
22

3-
```
3+
```text
44
docker buildx build [OPTIONS] PATH | URL | -
55
```
66

@@ -64,14 +64,14 @@ The `buildx build` command starts a build using BuildKit. This command is simila
6464
to the UI of `docker build` command and takes the same flags and arguments.
6565

6666
For documentation on most of these flags, refer to the [`docker build`
67-
documentation](https://docs.docker.com/engine/reference/commandline/build/). In
68-
here we'll document a subset of the new flags.
67+
documentation](https://docs.docker.com/engine/reference/commandline/build/).
68+
This page describes a subset of the new flags.
6969

7070
## Examples
7171

7272
### <a name="attest"></a> Create attestations (--attest)
7373

74-
```
74+
```text
7575
--attest=type=sbom,...
7676
--attest=type=provenance,...
7777
```
@@ -98,7 +98,7 @@ BuildKit currently supports:
9898

9999
### <a name="allow"></a> Allow extra privileged entitlement (--allow)
100100

101-
```
101+
```text
102102
--allow=ENTITLEMENT
103103
```
104104

@@ -109,9 +109,7 @@ Allow extra privileged entitlement. List of entitlements:
109109
[related Dockerfile extensions](https://docs.docker.com/engine/reference/builder/#run---securitysandbox).
110110

111111
For entitlements to be enabled, the `buildkitd` daemon also needs to allow them
112-
with `--allow-insecure-entitlement` (see [`create --buildkitd-flags`](buildx_create.md#buildkitd-flags))
113-
114-
**Examples**
112+
with `--allow-insecure-entitlement` (see [`create --buildkitd-flags`](buildx_create.md#buildkitd-flags)).
115113

116114
```console
117115
$ docker buildx create --use --name insecure-builder --buildkitd-flags '--allow-insecure-entitlement security.insecure'
@@ -122,23 +120,21 @@ $ docker buildx build --allow security.insecure .
122120

123121
Same as [`docker build` command](https://docs.docker.com/engine/reference/commandline/build/#build-arg).
124122

125-
There are also useful built-in build args like:
123+
There are also useful built-in build arguments, such as:
126124

127-
* `BUILDKIT_CONTEXT_KEEP_GIT_DIR=<bool>` trigger git context to keep the `.git` directory
128-
* `BUILDKIT_INLINE_CACHE=<bool>` inline cache metadata to image config or not
129-
* `BUILDKIT_MULTI_PLATFORM=<bool>` opt into deterministic output regardless of multi-platform output or not
125+
* `BUILDKIT_CONTEXT_KEEP_GIT_DIR=<bool>`: trigger git context to keep the `.git` directory
126+
* `BUILDKIT_INLINE_CACHE=<bool>`: inline cache metadata to image config or not
127+
* `BUILDKIT_MULTI_PLATFORM=<bool>`: opt into deterministic output regardless of multi-platform output or not
130128

131129
```console
132130
$ docker buildx build --build-arg BUILDKIT_MULTI_PLATFORM=1 .
133131
```
134132

135-
> **Note**
136-
>
137-
> More built-in build args can be found in [Dockerfile reference docs](https://docs.docker.com/engine/reference/builder/#buildkit-built-in-build-args).
133+
Learn more about the built-in build arguments in the [Dockerfile reference docs](https://docs.docker.com/engine/reference/builder/#buildkit-built-in-build-args).
138134

139135
### <a name="build-context"></a> Additional build contexts (--build-context)
140136

141-
```
137+
```text
142138
--build-context=name=VALUE
143139
```
144140

@@ -166,7 +162,7 @@ FROM alpine
166162
COPY --from=project myfile /
167163
```
168164

169-
#### <a name="source-oci-layout"></a> Source image from OCI layout directory
165+
#### <a name="source-oci-layout"></a> Use an OCI layout directory as build context
170166

171167
Source an image from a local [OCI layout compliant directory](https://github.com/opencontainers/image-spec/blob/main/image-layout.md),
172168
either by tag, or by digest:
@@ -194,7 +190,7 @@ Same as [`buildx --builder`](buildx.md#builder).
194190

195191
### <a name="cache-from"></a> Use an external cache source for a build (--cache-from)
196192

197-
```
193+
```text
198194
--cache-from=[NAME|type=TYPE[,KEY=VALUE]]
199195
```
200196

@@ -230,7 +226,7 @@ More info about cache exporters and available attributes: https://github.com/mob
230226

231227
### <a name="cache-to"></a> Export build cache to an external cache destination (--cache-to)
232228

233-
```
229+
```text
234230
--cache-to=[NAME|type=TYPE[,KEY=VALUE]]
235231
```
236232

@@ -247,9 +243,8 @@ Export build cache to an external cache destination. Supported types are
247243
- [`s3` type](https://github.com/moby/buildkit#s3-cache-experimental) exports
248244
cache to a S3 bucket.
249245

250-
`docker` driver currently only supports exporting inline cache metadata to image
251-
configuration. Alternatively, `--build-arg BUILDKIT_INLINE_CACHE=1` can be used
252-
to trigger inline cache exporter.
246+
The `docker` driver only supports cache exports using the `inline` and `local`
247+
cache backends.
253248

254249
Attribute key:
255250

@@ -283,6 +278,7 @@ directory of the specified file must already exist and be writable.
283278
$ docker buildx build --load --metadata-file metadata.json .
284279
$ cat metadata.json
285280
```
281+
286282
```json
287283
{
288284
"containerimage.config.digest": "sha256:2937f66a9722f7f4a2df583de2f8cb97fc9196059a410e7f00072fc918930e66",
@@ -301,14 +297,14 @@ $ cat metadata.json
301297

302298
### <a name="output"></a> Set the export action for the build result (-o, --output)
303299

304-
```
300+
```text
305301
-o, --output=[PATH,-,type=TYPE[,KEY=VALUE]
306302
```
307303

308304
Sets the export action for the build result. In `docker build` all builds finish
309305
by creating a container image and exporting it to `docker images`. `buildx` makes
310306
this step configurable allowing results to be exported directly to the client,
311-
oci image tarballs, registry etc.
307+
OCI image tarballs, registry etc.
312308

313309
Buildx with `docker` driver currently only supports local, tarball exporter and
314310
image exporter. `docker-container` driver supports all the exporters.
@@ -363,15 +359,15 @@ The `docker` export type writes the single-platform result image as a [Docker im
363359
specification](https://github.com/docker/docker/blob/v20.10.2/image/spec/v1.2.md)
364360
tarball on the client. Tarballs created by this exporter are also OCI compatible.
365361

366-
Currently, multi-platform images cannot be exported with the `docker` export type.
367-
The most common usecase for multi-platform images is to directly push to a registry
368-
(see [`registry`](#registry)).
362+
The default image store in Docker Engine doesn't support loading multi-platform
363+
images. You can enable the containerd image store, or push multi-platform images
364+
is to directly push to a registry, see [`registry`](#registry).
369365

370366
Attribute keys:
371367

372-
- `dest` - destination path where tarball will be written. If not specified the
373-
tar will be loaded automatically to the current docker instance.
374-
- `context` - name for the docker context where to import the result
368+
- `dest` - destination path where tarball will be written. If not specified,
369+
the tar will be loaded automatically to the local image store.
370+
- `context` - name for the Docker context where to import the result
375371

376372
#### `image`
377373

@@ -382,15 +378,15 @@ can be automatically pushed to a registry by specifying attributes.
382378
Attribute keys:
383379

384380
- `name` - name (references) for the new image.
385-
- `push` - boolean to automatically push the image.
381+
- `push` - Boolean to automatically push the image.
386382

387383
#### `registry`
388384

389385
The `registry` exporter is a shortcut for `type=image,push=true`.
390386

391387
### <a name="platform"></a> Set the target platforms for the build (--platform)
392388

393-
```
389+
```text
394390
--platform=value[,value]
395391
```
396392

@@ -419,12 +415,12 @@ and `arm` architectures. You can see what runtime platforms your current builder
419415
instance supports by running `docker buildx inspect --bootstrap`.
420416

421417
Inside a `Dockerfile`, you can access the current platform value through
422-
`TARGETPLATFORM` build argument. Please refer to the [`docker build`
418+
`TARGETPLATFORM` build argument. Refer to the [`docker build`
423419
documentation](https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope)
424420
for the full description of automatic platform argument variants .
425421

426-
The formatting for the platform specifier is defined in the [containerd source
427-
code](https://github.com/containerd/containerd/blob/v1.4.3/platforms/platforms.go#L63).
422+
You can find the formatting definition for the platform specifier in the
423+
[containerd source code](https://github.com/containerd/containerd/blob/v1.4.3/platforms/platforms.go#L63).
428424

429425
```console
430426
$ docker buildx build --platform=linux/arm64 .
@@ -434,11 +430,11 @@ $ docker buildx build --platform=darwin .
434430

435431
### <a name="progress"></a> Set type of progress output (--progress)
436432

437-
```
433+
```text
438434
--progress=VALUE
439435
```
440436

441-
Set type of progress output (auto, plain, tty). Use plain to show container
437+
Set type of progress output (`auto`, `plain`, `tty`). Use plain to show container
442438
output (default "auto").
443439

444440
> **Note**
@@ -472,15 +468,18 @@ provenance attestations for the build result. For example,
472468
`--provenance=mode=max` can be used as an abbreviation for
473469
`--attest=type=provenance,mode=max`.
474470

475-
Additionally, `--provenance` can be used with boolean values to broadly enable
476-
or disable provenance attestations. For example, `--provenance=false` can be
477-
used to disable all provenance attestations, while `--provenance=true` can be
478-
used to enable all provenance attestations.
471+
Additionally, `--provenance` can be used with Boolean values to enable or disable
472+
provenance attestations. For example, `--provenance=false` disables all provenance attestations,
473+
while `--provenance=true` enables all provenance attestations.
479474

480475
By default, a minimal provenance attestation will be created for the build
481-
result, which will only be attached for images pushed to registries.
476+
result. Note that the default image store in Docker Engine doesn't support
477+
attestations. Provenance attestations only persist for images pushed directly
478+
to a registry if you use the default image store. Alternatively, you can switch
479+
to using the containerd image store.
482480

483-
For more information, see [here](https://docs.docker.com/build/attestations/slsa-provenance/).
481+
For more information about provenance attestations, see
482+
[here](https://docs.docker.com/build/attestations/slsa-provenance/).
484483

485484
### <a name="push"></a> Push the build result to a registry (--push)
486485

@@ -494,15 +493,19 @@ attestations for the build result. For example,
494493
`--sbom=generator=<user>/<generator-image>` can be used as an abbreviation for
495494
`--attest=type=sbom,generator=<user>/<generator-image>`.
496495

497-
Additionally, `--sbom` can be used with boolean values to broadly enable or
498-
disable SBOM attestations. For example, `--sbom=false` can be used to disable
499-
all SBOM attestations.
496+
Additionally, `--sbom` can be used with Boolean values to enable or disable
497+
SBOM attestations. For example, `--sbom=false` disables all SBOM attestations.
498+
499+
Note that the default image store in Docker Engine doesn't support
500+
attestations. Provenance attestations only persist for images pushed directly
501+
to a registry if you use the default image store. Alternatively, you can switch
502+
to using the containerd image store.
500503

501504
For more information, see [here](https://docs.docker.com/build/attestations/sbom/).
502505

503506
### <a name="secret"></a> Secret to expose to the build (--secret)
504507

505-
```
508+
```text
506509
--secret=[type=TYPE[,KEY=VALUE]
507510
```
508511

@@ -515,7 +518,7 @@ If `type` is unset it will be detected. Supported types are:
515518

516519
Attribute keys:
517520

518-
- `id` - ID of the secret. Defaults to basename of the `src` path.
521+
- `id` - ID of the secret. Defaults to base name of the `src` path.
519522
- `src`, `source` - Secret filename. `id` used if unset.
520523

521524
```dockerfile
@@ -557,7 +560,7 @@ optional and can be `b` (bytes), `k` (kilobytes), `m` (megabytes), or `g`
557560

558561
### <a name="ssh"></a> SSH agent socket or keys to expose to the build (--ssh)
559562

560-
```
563+
```text
561564
--ssh=default|<id>[=<socket>|<key>[,<key>]]
562565
```
563566

@@ -597,6 +600,6 @@ $ docker buildx build --ulimit nofile=1024:1024 .
597600

598601
> **Note**
599602
>
600-
> If you do not provide a `hard limit`, the `soft limit` is used
601-
> for both values. If no `ulimits` are set, they are inherited from
603+
> If you don't provide a `hard limit`, the `soft limit` is used
604+
> for both values. If no `ulimits` are set, they're inherited from
602605
> the default `ulimits` set on the daemon.

0 commit comments

Comments
 (0)