Using multiple builders
By default, Buildx uses the
docker driver if it is supported, providing a user
experience very similar to the native
docker build. Note that you must use a
local shared daemon to build your applications.
Buildx allows you to create new instances of isolated builders. You can use this to get a scoped environment for your CI builds that does not change the state of the shared daemon, or for isolating builds for different projects. You can create a new instance for a set of remote nodes, forming a build farm, and quickly switch between them.
You can create new instances using the
docker buildx create
command. This creates a new builder instance with a single node based on your
To use a remote node you can specify the
DOCKER_HOST or the remote context name
while creating the new builder. After creating a new instance, you can manage its
lifecycle using the
docker buildx inspect,
docker buildx stop, and
docker buildx rm commands.
To list all available builders, use
docker buildx ls.
After creating a new builder you can also append new nodes to it.
To switch between different builders, use
docker buildx use <name>.
After running this command, the build commands will automatically use this
Docker also features a
command that you can use to provide names for remote Docker API endpoints. Buildx
docker context to ensure all the contexts automatically get a
default builder instance. You can also set the context name as the target when
you create a new builder instance or when you add a node to it.