Build drivers (original) (raw)
Build drivers are configurations for how and where the BuildKit backend runs. Driver settings are customizable and allow 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 differences between drivers.
Feature | docker | docker-container | kubernetes | remote |
---|---|---|---|---|
Automatically load image | ✅ | |||
Cache export | ✅* | ✅ | ✅ | ✅ |
Tarball output | ✅ | ✅ | ✅ | |
Multi-arch images | ✅ | ✅ | ✅ | |
BuildKit configuration | ✅ | ✅ | Managed externally |
* The docker
driver doesn't support all cache export options. SeeCache storage backends for more information.
Unlike when using the default docker
driver, images built using other drivers aren't automatically loaded into the local image store. If you don't specify an output, the build result is exported to the build cache only.
To build an image using a non-default driver and load it to the image store, use the --load
flag with the build command:
With this option, the image is available in the image store after the build finishes:
Load by default
Requires: Docker Buildx0.14.0 and later
You can configure the custom build drivers to behave in a similar way to the default docker
driver, and load images to the local image store by default. To do so, set the default-load
driver option when creating the builder:
Note that, just like with the docker
driver, if you specify a different output format with --output
, the result will not be loaded to the image store unless you also explicitly specify --output type=docker
or use the --load
flag.
Read about each driver: