Skip to content

Commit 8638690

Browse files
committed
build: mention docker buildx install
Signed-off-by: David Karlsson <[email protected]>
1 parent 753cf3e commit 8638690

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

content/manuals/build/builders/_index.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,48 @@ To switch between builders, use the `docker buildx use <name>` command.
6565
After running this command, the builder you specify is automatically
6666
selected when you invoke builds.
6767

68+
### Difference between `docker build` and `docker buildx build`
69+
70+
Even though `docker build` is an alias for `docker buildx build`, there are
71+
subtle differences between the two commands. With Buildx, the build client and
72+
the and daemon (BuildKit) are decoupled. This means you can use multiple
73+
builders from a single client, even remote ones.
74+
75+
The `docker build` command always defaults to using the default builder that
76+
comes bundled with the Docker Engine, for ensuring backwards compatibility with
77+
older versions of the Docker CLI. The `docker buildx build` command, on the
78+
other hand, checks whether you've set a different builder as the default
79+
builder before it sends your build to BuildKit.
80+
81+
To use the `docker build` command with a non-default builder, you must either:
82+
83+
- Specify the builder explicitly, using the `--builder` flag or the `BUILDX_BUILDER` environment variable:
84+
85+
```console
86+
$ BUILDX_BUILDER=my_builder docker build .
87+
$ docker build --builder my_builder .
88+
```
89+
90+
- Configure Buildx as the default client by running the following command:
91+
92+
```console
93+
$ docker buildx install
94+
```
95+
96+
This updates your [Docker CLI configuration file](/reference/cli/docker/_index.md#configuration-files)
97+
to ensure all of your build-related commands are routed via Buildx.
98+
99+
> [!TIP]
100+
> To undo this change, run `docker buildx uninstall`.
101+
102+
<!-- vale Docker.We = NO -->
103+
104+
In general, we recommend that you use the `docker buildx build` command when
105+
you want to use custom builders. This ensures that your [selected
106+
builder](#selected-builder) configuration is interpreted correctly.
107+
108+
<!-- vale Docker.We = YES -->
109+
68110
## Additional information
69111

70112
- For information about how to interact with and manage builders,

content/manuals/build/concepts/overview.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ the CLI plugin from source, or grab a binary from the GitHub repository and
3838
install it manually. See [Buildx README](https://github.com/docker/buildx#manual-download)
3939
on GitHub for more information.
4040

41+
> [!NOTE]
42+
> While `docker build` invokes Buildx under the hood, there are subtle
43+
> differences between this command and the canonical `docker buildx build`.
44+
> For details, see [Difference between `docker build` and `docker buildx build`](../builders/_index.md#difference-between-docker-build-and-docker-buildx-build).
45+
4146
## BuildKit
4247

4348
BuildKit is the daemon process that executes the build workloads.

0 commit comments

Comments
 (0)