Build docker containers with buildx
buildx is a CLI tool that provides a user interface for working with builds. Buildx is a drop-in
replacement for the legacy build
client used in earlier versions of Docker Engine and
Docker Desktop. In newer versions of Docker Desktop and Docker Engine, you’re using Buildx
by default when you invoke the docker build
command. In earlier versions, to build using
Buildx you would use the docker buildx build
command.
As of Docker Engine 23.0 and Docker Desktop 4.19, Buildx is the default build client.
One of the most important features of Buildx is the ability to build multi-platform images.
You can create arm64
and amd64
images in one build and push them to the same repository.
You can read more about buildx in official documentation.
Create builder
First you need to create builder:
then you can check if it is active:
Build multiplatform image
The following example shows how to build multiplatform image from Dockerfile
: