commit
9ad39a29f7
@ -1,48 +1,30 @@
|
||||
# Docker driver
|
||||
|
||||
The buildx docker driver is the default builtin driver, that uses the BuildKit
|
||||
server components built directly into the docker engine.
|
||||
The Buildx Docker driver is the default driver. It uses the BuildKit server
|
||||
components built directly into the Docker engine. The Docker driver requires no
|
||||
configuration.
|
||||
|
||||
No setup should be required for the docker driver - it should already be
|
||||
configured for you:
|
||||
Unlike the other drivers, builders using the Docker driver can't be manually
|
||||
created. They're only created automatically from the Docker context.
|
||||
|
||||
```console
|
||||
$ docker buildx ls
|
||||
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
|
||||
default docker
|
||||
default default running 20.10.17 linux/amd64, linux/386
|
||||
```
|
||||
Images built with the Docker driver are automatically loaded to the local image
|
||||
store.
|
||||
|
||||
This builder is ready to build with out-of-the-box, requiring no extra setup,
|
||||
so you can get going with a `docker buildx build` as soon as you like.
|
||||
|
||||
Depending on your personal setup, you may find multiple builders in your list
|
||||
the use the docker driver. For example, on a system that runs both a package
|
||||
managed version of dockerd, as well as Docker Desktop, you might have the
|
||||
following:
|
||||
## Synopsis
|
||||
|
||||
```console
|
||||
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
|
||||
default docker
|
||||
default default running 20.10.17 linux/amd64, linux/386
|
||||
desktop-linux * docker
|
||||
desktop-linux desktop-linux running 20.10.17 linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6
|
||||
# The Docker driver is used by buildx by default
|
||||
docker buildx build .
|
||||
```
|
||||
|
||||
This is because the docker driver builders are automatically pulled from
|
||||
the available [Docker Contexts](https://docs.docker.com/engine/context/working-with-contexts/).
|
||||
When you add new contexts using `docker context create`, these will appear in
|
||||
your list of buildx builders.
|
||||
|
||||
Unlike the [other drivers](./index.md), builders using the docker driver
|
||||
cannot be manually created, and can only be automatically created from the
|
||||
docker context. Additionally, they cannot be configured to a specific BuildKit
|
||||
version, and cannot take any extra parameters, as these are both preset by the
|
||||
Docker engine internally.
|
||||
It's not possible to configure which BuildKit version to use, or to pass any
|
||||
additional BuildKit parameters to a builder using the Docker driver. The
|
||||
BuildKit version and parameters are preset by the Docker engine internally.
|
||||
|
||||
If you want the extra configuration and flexibility without too much more
|
||||
overhead, then see the help page for the [docker-container driver](./docker-container.md).
|
||||
If you need additional configuration and flexibility, consider using the
|
||||
[Docker container driver](./docker-container.md).
|
||||
|
||||
## Further reading
|
||||
|
||||
For more information on the docker driver, see the [buildx reference](https://docs.docker.com/engine/reference/commandline/buildx_create/#driver).
|
||||
For more information on the Docker driver, see the
|
||||
[buildx reference](https://docs.docker.com/engine/reference/commandline/buildx_create/#driver).
|
||||
|
@ -1,39 +1,76 @@
|
||||
# Buildx drivers overview
|
||||
|
||||
The buildx client connects out to the BuildKit backend to execute builds -
|
||||
Buildx drivers allow fine-grained control over management of the backend, and
|
||||
supports several options for where and how BuildKit should run.
|
||||
|
||||
Currently, we support the following drivers:
|
||||
|
||||
- The `docker` driver, that uses the BuildKit library bundled into the Docker
|
||||
daemon.
|
||||
([guide](./docker.md), [reference](https://docs.docker.com/engine/reference/commandline/buildx_create/#docker-driver-1))
|
||||
- The `docker-container` driver, that launches a dedicated BuildKit container
|
||||
using Docker, for access to advanced features.
|
||||
([guide](./docker-container.md), [reference](https://docs.docker.com/engine/reference/commandline/buildx_create/#docker-container-driver-1))
|
||||
- The `kubernetes` driver, that launches dedicated BuildKit pods in a
|
||||
remote Kubernetes cluster, for scalable builds.
|
||||
([guide](./kubernetes.md), [reference](https://docs.docker.com/engine/reference/commandline/buildx_create/#kubernetes-driver-1))
|
||||
- The `remote` driver, that allows directly connecting to a manually managed
|
||||
BuildKit daemon, for more custom setups.
|
||||
([guide](./remote.md), [reference](https://docs.docker.com/engine/reference/commandline/buildx_create/#remote-driver-1))
|
||||
|
||||
To create a new builder that uses one of the above drivers, you can use the
|
||||
[`docker buildx create`](https://docs.docker.com/engine/reference/commandline/buildx_create/) command:
|
||||
Buildx drivers are configurations for how and where the BuildKit backend runs.
|
||||
Driver settings are customizable and allows fine-grained control of the builder.
|
||||
Buildx supports the following drivers:
|
||||
|
||||
- `docker`: uses the BuildKit library bundled into the Docker daemon.
|
||||
- `docker-container`: creates a dedicated BuildKit container using Docker.
|
||||
- `kubernetes`: creates BuildKit pods in a Kubernetes cluster.
|
||||
- `remote`: connects directly to a manually managed BuildKit daemon.
|
||||
|
||||
Different drivers support different use cases. The default `docker` driver
|
||||
prioritizes simplicity and ease of use. It has limited support for advanced
|
||||
features like caching and output formats, and isn't configurable. Other drivers
|
||||
provide more flexibility and are better at handling advanced scenarios.
|
||||
|
||||
The following table outlines some of the differences between drivers.
|
||||
|
||||
| Feature | `docker` | `docker-container` | `kubernetes` | `remote` |
|
||||
| :--------------------------- | :---------: | :----------------: | :----------: | :----------------: |
|
||||
| **Automatically load image** | ✅ | | | |
|
||||
| **Cache export** | Inline only | ✅ | ✅ | ✅ |
|
||||
| **Tarball output** | | ✅ | ✅ | ✅ |
|
||||
| **Multi-arch images** | | ✅ | ✅ | ✅ |
|
||||
| **BuildKit configuration** | | ✅ | ✅ | Managed externally |
|
||||
|
||||
## List available builders
|
||||
|
||||
Use `docker buildx ls` to see builder instances available on your system, and
|
||||
the drivers they're using.
|
||||
|
||||
```console
|
||||
$ docker buildx ls
|
||||
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
|
||||
default docker
|
||||
default default running 20.10.17 linux/amd64, linux/386
|
||||
```
|
||||
|
||||
Depending on your setup, you may find multiple builders in your list that use
|
||||
the Docker driver. For example, on a system that runs both a manually installed
|
||||
version of dockerd, as well as Docker Desktop, you might see the following
|
||||
output from `docker buildx ls`:
|
||||
|
||||
```console
|
||||
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
|
||||
default docker
|
||||
default default running 20.10.17 linux/amd64, linux/386
|
||||
desktop-linux * docker
|
||||
desktop-linux desktop-linux running 20.10.17 linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6
|
||||
```
|
||||
|
||||
This is because the Docker driver builders are automatically pulled from the
|
||||
available
|
||||
[Docker Contexts](https://docs.docker.com/engine/context/working-with-contexts/).
|
||||
When you add new contexts using `docker context create`, these will appear in
|
||||
your list of buildx builders.
|
||||
|
||||
## Create a new builder
|
||||
|
||||
Use the
|
||||
[`docker buildx create`](https://docs.docker.com/engine/reference/commandline/buildx_create/)
|
||||
command to create a builder, and specify the driver using the `--driver` option.
|
||||
|
||||
```console
|
||||
$ docker buildx create --name=<builder-name> --driver=<driver> --driver-opt=<driver-options>
|
||||
```
|
||||
|
||||
The build experience is very similar across drivers, however, there are some
|
||||
features that are not evenly supported across the board, notably, the `docker`
|
||||
driver does not include support for certain output/caching types.
|
||||
## What's next
|
||||
|
||||
| Feature | `docker` | `docker-container` | `kubernetes` | `remote` |
|
||||
| :---------------------------- | :-------------: | :----------------: | :----------: | :--------------------: |
|
||||
| **Automatic `--load`** | ✅ | ❌ | ❌ | ❌ |
|
||||
| **Cache export** | ❔ (inline only) | ✅ | ✅ | ✅ |
|
||||
| **Docker/OCI tarball output** | ❌ | ✅ | ✅ | ✅ |
|
||||
| **Multi-arch images** | ❌ | ✅ | ✅ | ✅ |
|
||||
| **BuildKit configuration** | ❌ | ✅ | ✅ | ❔ (managed externally) |
|
||||
Read about each of the Buildx drivers to learn about how they work and how to
|
||||
use them:
|
||||
|
||||
- [Docker driver](./docker.md)
|
||||
- [Docker container driver](./docker-container.md)
|
||||
- [Kubernetes driver](./kubernetes.md)
|
||||
- [Remote driver](./remote.md)
|
||||
|
Loading…
Reference in New Issue