Skip to content

Commit 97bf319

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

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

content/manuals/build/builders/_index.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,46 @@ 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. The `docker buildx build` command, on the
77+
other hand, checks whether you've set a different builder as the default
78+
builder before it sends your build to BuildKit.
79+
80+
To use the `docker build` command with a non-default builder, you must either:
81+
82+
- Specify the builder explicitly, using the `--builder` flag:
83+
84+
```console
85+
$ docker build --builder my_builder .
86+
```
87+
88+
- Configure Buildx as the default client by running the following command:
89+
90+
```console
91+
$ docker buildx install
92+
```
93+
94+
This updates your [Docker CLI configuration file](/reference/cli/docker/_index.md#configuration-files)
95+
to ensure all of your build-related commands are routed via Buildx.
96+
97+
> [!TIP]
98+
> To undo this change, run `docker buildx uninstall`.
99+
100+
<!-- vale Docker.We = NO -->
101+
102+
In general, we recommend that you use the `docker buildx build` command when
103+
you want to use custom builders. This ensures that your [selected
104+
builder](#selected-builder) configuration is interpreted correctly.
105+
106+
<!-- vale Docker.We = YES -->
107+
68108
## Additional information
69109

70110
- 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)