How to build docker images for multiple CPU architectures Link to heading
Firstly create a new buildx instance, in this case for ARM architectures (Raspberry Pi’s for example):
❯ docker buildx create --use --platform=linux/arm64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 --name arm-builder
arm-builder
❯ docker buildx inspect --bootstrap
...
Name: arm-builder
Driver: docker-container
Last Activity: 2024-09-19 12:46:27 +0000 UTC
Nodes:
Name: arm-builder0
Endpoint: unix:///var/run/docker.sock
Status: running
BuildKit daemon flags: --allow-insecure-entitlement=network.host
BuildKit version: v0.16.0
Platforms: linux/arm64*, linux/arm/v6*, linux/arm/v7*,
...
Or for other architectures:
❯ docker buildx create --use --platform=linux/mips64le,linux/mips64,linux/arm64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/amd64 --name all-the-archs-builder
all-the-archs-builder
❯ docker buildx inspect --bootstrap
...
Name: all-the-archs-builder
Driver: docker-container
Last Activity: 2024-09-19 12:47:09 +0000 UTC
Nodes:
Name: all-the-archs-builder0
Endpoint: unix:///var/run/docker.sock
Status: running
BuildKit daemon flags: --allow-insecure-entitlement=network.host
BuildKit version: v0.16.0
Platforms: linux/mips64le*, linux/mips64*, linux/arm64*, linux/arm/v6*, linux/arm/v7*, linux/amd64*, linux/amd64/v2, linux/amd64/v3, linux/386
...
Some other platforms you can build for:
linux/arm64
linux/amd64
linux/amd64/v2
linux/riscv64
linux/ppc64le
linux/s390x
linux/386
linux/mips64le
linux/mips64
linux/arm/v7
linux/arm/v6
To list all of the builders you have on your system:
❯ docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
all-the-archs-builder docker-container
\_ all-the-archs-builder0 \_ unix:///var/run/docker.sock inactive linux/mips64le*, linux/mips64*, linux/arm64*, linux/arm/v6*, linux/arm/v7*, linux/amd64*
arm-builder* docker-container
\_ arm-builder0 \_ unix:///var/run/docker.sock inactive linux/arm64*, linux/arm/v6*, linux/arm/v7*
default docker
\_ default \_ default running v0.14.1 linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/386
Building for Raspberry Pi:
❯ docker build --platform linux/arm64/v8 --push --builder arm-builder --tag gitlab.muhdomain.com:5943/gitlab/container-name:arm .
Gitlab ‘missing manifest digest’ error Link to heading
If you’re getting the error: Invalid tag: missing manifest digest
, add the flag --provenance=false
to the build command:
For example:
docker build --platform linux/arm64/v8 --push --provenance=false --builder arm-builder --tag gitlab.muhdomain.com:5943/gitlab/container-name:arm64 .