In this step, we will learn how to specify the platforms that a build node supports. This is crucial for building multi-architecture images. By default, a node will support the architecture of the host it is running on. However, with Buildx, you can configure nodes to support additional platforms using emulation (like QEMU).
First, let's inspect the custombuilder
we created in the previous step to see the platforms supported by its node.
docker buildx inspect custombuilder
Look for the "Platforms" field in the output. It should show the native architecture of your LabEx VM (e.g., linux/amd64
).
Now, let's update the node1
within custombuilder
to support additional platforms. We can use the docker buildx create
command with the --append
flag and the --platform
flag. We will add support for linux/arm64
and linux/riscv64
.
docker buildx create --name custombuilder --append --node node1 --platform linux/arm64,linux/riscv64
Note that we are using --append
with the existing builder name and node name. This command updates the existing node node1
within custombuilder
to include the specified platforms.
Let's inspect the builder again to see the updated platforms for node1
.
docker buildx inspect custombuilder
The "Platforms" field for node1
should now include linux/amd64
, linux/arm64
, and linux/riscv64
. This means this node is now capable of building images for these architectures.