buildx and BuildKit with Docker: One Image for Your PC and Your Raspberry Pi (Linux, Windows, Mac)
Before you start
- 25 min read
Boxes marked Run in terminal are what you type; plain text explains why. Check what you need first

What you get in one minute#
buildx is the command behind docker build (it is docker buildx build), and BuildKit is the engine that does the work. Together they build one image that runs on a normal PC (amd64) and on a Raspberry Pi (arm64), push it to your own registry under a single tag, reuse earlier work from a cache, and keep passwords out of the finished image.
Logo: buildx and BuildKit have no logo of their own (we looked through both repositories on 5 December 2026). This is the official BuildKit build-graph diagram from the Docker docs (github.com/docker/docs, file content/manuals/build/images/buildkit-dag.svg), Apache-2.0, unchanged (stand-in).
You build on your fast PC, and the Pi just runs docker pull and gets the version for its own CPU. The default builder cannot do this alone, which is why first attempts often end in an error (see Common mistakes).
| What | Value (official sources, read 5 December 2026) |
|---|---|
| Versions | buildx v0.39.1 and BuildKit v0.35.1, both released 19 November 2026. Dockerfile frontend 1.29.0 (11 November 2026) |
| Builder image to pin | moby/buildkit:v0.35.1 (tag checked on Docker Hub; amd64, arm64, arm/v7 and more) |
| Licence | Apache-2.0 for both repositories (GitHub API) |
| Time needed | About 45 minutes (our estimate, not measured) |
| RAM and disk | Not measured; the docs give no minimum |
| Ports | None published |
| Official docs | docs.docker.com/build |
At a glance:
- What you build: one tag with two images inside, for
linux/amd64andlinux/arm64. - Where it goes: your private registry (Docker Registry guide), which also holds the cache.
- What keeps it safe: build secrets (never
ARG) and an SBOM you can scan with Grype. - Related: Bake can also read Compose files, see our Docker Compose guide.
Which version. v0.39.0 broke builds with large .dockerignore files (issue 4209); v0.39.1 fixed it. Releases 0.37.2 and 0.38.2 closed holes in Bake's file-access checks. So: v0.38.2 or newer, and we pin v0.39.1.
How it fits together#
You run docker buildx bake. It sends the job to a BuildKit builder, which is a container on your machine. The builder makes both images (the other CPU type through QEMU emulation), pushes them to your registry, and stores a cache image next to them.
Drawn for this guide from the official Docker build docs. The dashed step is optional.
Three words: a builder is a BuildKit daemon that runs your build, a driver decides where it runs, and an image index is one tag that points to one image per CPU type.
Before you start#
Note: every host name, user, password and token on this page is a dummy value (
registry.example.com,change-me). Replace it with your own, and keep real secrets out of Git.
| System | What to have |
|---|---|
| Linux | Docker Engine plus Docker's docker-buildx-plugin package (install page) |
| Windows | Docker Desktop (WSL 2). PowerShell 7 is best for Step 8 |
| Mac | Docker Desktop, Intel or Apple Silicon |
| Registry | An HTTPS registry with a login (Docker Registry guide) |
| Raspberry Pi | 64-bit Raspberry Pi OS with Docker (no Engine packages for 32-bit Pi OS from v29) |
docker --version docker buildx version
Checklist:
- [ ]
docker buildx versionprints v0.38.2 or newer - [ ] You can
docker loginto your registry - [ ] Your Dockerfile and bake file will live in Git
Tested by DIY Lab Hub: not yet. The commands come from the official docs and sources read on 5 December 2026. We did not run them, so every "expected" text below is the docs' shape or our reading, never captured output.
Tip: A distribution's own
docker.iopackage may come without buildx. Install Docker's packages and checkdocker buildx versionfirst.
LLM Guide: let your AI assistant set it up#
We can use an AI assistant to follow this guide. Copy the block below into ChatGPT, Claude, Gemini or a local model. It first asks about your setup, then follows only the path that fits you.
Use buildx v0.39.1 and BuildKit v0.35.1 to build one image for amd64 and arm64.
Follow https://diylabhub.com/buildx-buildkit/ (checked 5 December 2026).
Work one step at a time. Explain each command first. Wait for my OK before deleting data, stopping services, changing my router or opening ports.
STEP 0 - FIND OUT MY SETUP:
1. Which system: Linux, Windows PowerShell or Mac, Intel or Apple Silicon? Run docker --version and docker buildx version. Is Docker running?
2. Is the target Raspberry Pi running a 64-bit OS? Which platforms and private registry will I use?
3. Does the registry use a public certificate or a private CA? Is it behind Traefik, Caddy, nginx / Nginx Proxy Manager, or none?
4. Is this a local build, Forgejo Actions or Woodpecker pipeline? Which folder holds existing recipes, and are they backed up?
THEN FOLLOW THE MATCHING PATH:
- Linux: Docker Engine plus docker-buildx-plugin. Windows/Mac: Docker Desktop; PowerShell 7 for the SBOM export step.
- Create the docker-container builder below on all systems. A native Buildah/Podman route is a separate linked guide, not this workflow.
- Private registry CA: follow the guide's buildkitd.toml section and recreate the builder with the documented --buildkitd-config argument. Never invent insecure TLS workarounds.
- Traefik or Caddy secures the registry, not buildx. Traefik's registry entrypoint is https and resolver le; Caddy's reverse_proxy and tls internal route are in the registry guide. buildx has no web port.
- nginx / Nginx Proxy Manager: no recipe here; consult the registry documentation.
- Forgejo: use the guide's workflow and Docker daemon setup. Its container pin is shown below. Woodpecker uses the pinned plugin and its documented privileged-image allowlist.
Use ~/docker_volumes/buildx/{project,config,logs,backups}, or $HOME\docker_volumes\buildx in PowerShell. Save this Step 1 Dockerfile in project and create the dummy config/dl_token.txt using the guide's no-newline command:
# syntax=docker/dockerfile:1
FROM alpine:3.25.0
RUN mkdir -p /www && uname -m > /www/arch.txt
USER nobody
EXPOSE 8080
CMD ["httpd", "-f", "-p", "8080", "-h", "/www"]
Create and inspect the builder:
docker buildx create --name homelab --driver docker-container --driver-opt image=moby/buildkit:v0.35.1 --use --bootstrap
docker buildx ls
Log in: docker login registry.example.com --username change-me (enter the real password locally).
From project: docker buildx build --builder homelab --platform linux/amd64,linux/arm64 --tag registry.example.com/lab/hello-web:1.0.0 --push .
Then follow Steps 5-8 for a separate buildcache tag, secret mounts, the exact Bake file and SBOM. Never put the secret in ARG or ENV. Windows uses the guide's here-strings and PowerShell commands; Mac uses Linux commands.
Optional Forgejo workflow container fragment from the guide:
container:
image: docker:29.10.1-cli
CHECK IT WORKED:
docker buildx ls
docker buildx imagetools inspect registry.example.com/lab/hello-web:1.0.0
Expect the homelab builder running and amd64/arm64 manifests. After building 1.0.1 with the secret, /www/build.txt prints build secret received and /run/secrets/DL_TOKEN must be absent. Run the guide's SBOM extraction and Grype check, then the Step 9 PC/Pi curl checks: x86_64 or aarch64 as appropriate.
RULES FOR YOU:
Use Alpine 3.25.0, moby/buildkit:v0.35.1 and the guide's existing pinned CI/helper images. QEMU helper installation is conditional, not a required first step. Keep the builder and registry private, credentials and config/dl_token.txt out of Git. Do not confuse the old image store's --load limit with a failed push.
On an error, show it and read https://docs.docker.com/build/ before guessing. Use only the guide versions, never :latest or invented options. Example domains, paths and <placeholders> are dummies to replace locally. Never ask me to paste passwords, tokens or keys into chat.
Step 1: Create the folders and a tiny test project#
Everything lives under ~/docker_volumes/buildx. The test image serves one text file that shows which CPU type it was built for (the same idea as the Docker docs' uname -m example).
Linux#
mkdir -p ~/docker_volumes/buildx/{project,config,logs,backups}
cd ~/docker_volumes/buildx/project
cat > Dockerfile << 'EOF'
# syntax=docker/dockerfile:1
FROM alpine:3.25.0
RUN mkdir -p /www && uname -m > /www/arch.txt
USER nobody
EXPOSE 8080
CMD ["httpd", "-f", "-p", "8080", "-h", "/www"]
EOF
printf '%s' 'dummy-token-change-me' > ../config/dl_token.txt
chmod 700 ../config
chmod 600 ../config/dl_token.txt
Windows (PowerShell)#
$base = "$HOME\docker_volumes\buildx"
foreach ($d in "project","config","logs","backups") {
New-Item -ItemType Directory -Force "$base\$d" | Out-Null
}
Set-Location "$base\project"
@'
# syntax=docker/dockerfile:1
FROM alpine:3.25.0
RUN mkdir -p /www && uname -m > /www/arch.txt
USER nobody
EXPOSE 8080
CMD ["httpd", "-f", "-p", "8080", "-h", "/www"]
'@ | Set-Content -Encoding ascii Dockerfile
Set-Content -NoNewline -Encoding ascii "$base\config\dl_token.txt" 'dummy-token-change-me'
Mac (Terminal)#
Same commands as Linux.
We use Alpine 3.25.0, checked 5 December 2026. Its release notes change the default package mirror; this tiny image uses no added packages or version-specific application runtime, so its commands stay the same.
The first line, # syntax=docker/dockerfile:1, selects the current stable Dockerfile syntax. dl_token.txt holds a dummy token for Step 6, written without a trailing newline on purpose.
Check it worked. ls (Windows: Get-ChildItem) shows Dockerfile in project and dl_token.txt in config.
Step 2: Create a builder that can do two CPU types#
The default builder uses the docker driver, which the docs call simple but "isn't configurable". The docker-container driver runs BuildKit in its own container and supports multi-arch images, cache export and attestations.
Linux#
docker buildx create --name homelab --driver docker-container --driver-opt image=moby/buildkit:v0.35.1 --use --bootstrap docker buildx ls
Windows (PowerShell)#
docker buildx create --name homelab --driver docker-container --driver-opt image=moby/buildkit:v0.35.1 --use --bootstrap docker buildx ls
Mac (Terminal)#
Same commands as Linux.
We pin the builder image. Without image=, buildx pulls a rolling tag (the docs show moby/buildkit:buildx-stable-1).
Check it worked. docker buildx ls lists homelab * with driver docker-container and status running. The docs show a table of this shape; we did not run it. If emulation fails later, the docs install QEMU with a helper image (pinned here):
docker run --privileged --rm tonistiigi/binfmt:qemu-v10.2.3-68 --install all
Official BuildKit releases already bundle QEMU, so most readers never need this.
Tip: On fresh Docker Engine 29 and Docker Desktop installs the containerd image store lets even the default builder do multi-platform; an upgraded Engine may keep the old store. A
docker-containerbuilder behaves the same everywhere, so we use it on all three systems.
Step 3: Log in to your registry#
Linux#
docker login registry.example.com --username change-me
Windows (PowerShell)#
docker login registry.example.com --username change-me
Mac (Terminal)#
Same command as Linux.
Docker asks for the password; type it there so it stays out of your shell history. Per the docs, BuildKit asks buildx for registry credentials when it needs them, so the builder container does not need its own login.
Check it worked. The command prints Login Succeeded.
Optional: trust your own certificate authority#
Only if your registry uses Caddy's tls internal or another private CA (our registry guide shows how to export the root certificate). The builder runs in a container and does not see your PC's trust store, so give it the certificate in a BuildKit config file. Buildx copies files named there into the builder under /etc/buildkit/certs (docs).
Linux#
cat > ~/docker_volumes/buildx/config/buildkitd.toml << EOF [registry."registry.example.com"] ca = ["$HOME/docker_volumes/buildx/config/home-ca.crt"] EOF docker buildx rm homelab docker buildx create --name homelab --driver docker-container --driver-opt image=moby/buildkit:v0.35.1 --buildkitd-config ~/docker_volumes/buildx/config/buildkitd.toml --use --bootstrap
Windows (PowerShell)#
$ca = ("$HOME\docker_volumes\buildx\config\home-ca.crt").Replace('\','/')
@"
[registry."registry.example.com"]
ca = ["$ca"]
"@ | Set-Content -Encoding ascii "$HOME\docker_volumes\buildx\config\buildkitd.toml"
docker buildx rm homelab
docker buildx create --name homelab --driver docker-container --driver-opt image=moby/buildkit:v0.35.1 --buildkitd-config "$HOME\docker_volumes\buildx\config\buildkitd.toml" --use --bootstrap
Mac (Terminal)#
Same commands as Linux. We did not test the Windows path style; the TOML wants the absolute path on the machine that runs buildx. The file can also say http = true for a plain-HTTP registry; we do not recommend it.
Step 4: Build and push for amd64 and arm64#
Linux#
cd ~/docker_volumes/buildx/project docker buildx build --builder homelab --platform linux/amd64,linux/arm64 \ --tag registry.example.com/lab/hello-web:1.0.0 --push . docker buildx imagetools inspect registry.example.com/lab/hello-web:1.0.0
Windows (PowerShell)#
Set-Location "$HOME\docker_volumes\buildx\project" docker buildx build --builder homelab --platform linux/amd64,linux/arm64 ` --tag registry.example.com/lab/hello-web:1.0.0 --push . docker buildx imagetools inspect registry.example.com/lab/hello-web:1.0.0
Mac (Terminal)#
Same commands as Linux. On an Apple Silicon Mac the arm64 image builds natively and the amd64 one runs under emulation; on an Intel Mac or a PC it is the other way round.
Check it worked. The build ends without an error, and imagetools inspect lists two manifests, linux/amd64 and linux/arm64. BuildKit adds a small provenance attestation by default (docs), so the index can also list extra attestation entries; that is normal.
Without --push the docs warn: WARNING: No output specified with docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load. A multi-platform result cannot be loaded into the old image store, which is why we push.
Step 5: Keep a build cache in the registry#
A CI runner or fresh builder starts with nothing. The registry cache stores build steps as a separate image that the next build reuses. Its name must not be the image tag (docs); we use the tag buildcache.
Linux#
docker buildx build --builder homelab --platform linux/amd64,linux/arm64 \ --tag registry.example.com/lab/hello-web:1.0.0 \ --cache-to type=registry,ref=registry.example.com/lab/hello-web:buildcache,mode=max \ --cache-from type=registry,ref=registry.example.com/lab/hello-web:buildcache \ --push .
Windows (PowerShell)#
docker buildx build --builder homelab --platform linux/amd64,linux/arm64 ` --tag registry.example.com/lab/hello-web:1.0.0 ` --cache-to type=registry,ref=registry.example.com/lab/hello-web:buildcache,mode=max ` --cache-from type=registry,ref=registry.example.com/lab/hello-web:buildcache ` --push .
Mac (Terminal)#
Same command as Linux.
mode=max caches every layer, including intermediate steps; the default min only those of the final image. If the cache image does not exist yet, the import fails but the build goes on (docs), so the first run is normal.
Check it worked. Run the same command again. Steps that did not change should show CACHED in the progress output (our expectation; we did not run it). Your registry now also holds a buildcache tag next to 1.0.0.
Tip: A cache location is overwritten by the next write. Use one
refper branch (buildcache-main,buildcache-dev) and import from both with two--cache-fromflags (docs). The cache typeghais for GitHub Actions only.
Step 6: Pass a secret the safe way#
ARG and ENV values stay in the image; the docs say so, and BuildKit's rule SecretsUsedInArgOrEnv flags them. A secret mount is different: the file exists only while one RUN step runs. Replace the Dockerfile with this version (required=true makes a missing secret fail clearly):
Linux#
cd ~/docker_volumes/buildx/project
cat > Dockerfile << 'EOF'
# syntax=docker/dockerfile:1
FROM alpine:3.25.0
RUN mkdir -p /www && uname -m > /www/arch.txt
RUN --mount=type=secret,id=DL_TOKEN,required=true \
test -s /run/secrets/DL_TOKEN && echo "build secret received" > /www/build.txt
USER nobody
EXPOSE 8080
CMD ["httpd", "-f", "-p", "8080", "-h", "/www"]
EOF
export DL_TOKEN="$(cat ~/docker_volumes/buildx/config/dl_token.txt)"
docker buildx build --builder homelab --platform linux/amd64,linux/arm64 \
--tag registry.example.com/lab/hello-web:1.0.1 --secret id=DL_TOKEN --push .
Windows (PowerShell)#
Set-Location "$HOME\docker_volumes\buildx\project"
@'
# syntax=docker/dockerfile:1
FROM alpine:3.25.0
RUN mkdir -p /www && uname -m > /www/arch.txt
RUN --mount=type=secret,id=DL_TOKEN,required=true \
test -s /run/secrets/DL_TOKEN && echo "build secret received" > /www/build.txt
USER nobody
EXPOSE 8080
CMD ["httpd", "-f", "-p", "8080", "-h", "/www"]
'@ | Set-Content -Encoding ascii Dockerfile
$env:DL_TOKEN = Get-Content -Raw "$HOME\docker_volumes\buildx\config\dl_token.txt"
docker buildx build --builder homelab --platform linux/amd64,linux/arm64 `
--tag registry.example.com/lab/hello-web:1.0.1 --secret id=DL_TOKEN --push .
Mac (Terminal)#
Same commands as Linux.
Buildx reads the environment variable DL_TOKEN because it matches the secret id (docs). It lives only in this terminal.
Check it worked. The build succeeds. Now prove the secret is not in the image:
docker run --rm --entrypoint cat registry.example.com/lab/hello-web:1.0.1 /www/build.txt docker run --rm --entrypoint cat registry.example.com/lab/hello-web:1.0.1 /run/secrets/DL_TOKEN
The first prints build secret received; the second must fail with "No such file". PowerShell: same commands. To look at layers, see our dive guide.
Tip: Editors add a final newline, and
--secret ...,src=<file>passes the file as it is. The buildx maintainer says so in issue 4267: write the file without one (printf '%s',Set-Content -NoNewline), as in Step 1.
Step 7: Put it all in a Bake file#
Bake keeps the flags in a file, so you and your CI type one short command. The attributes below come from the Bake reference.
Linux#
cd ~/docker_volumes/buildx/project
cat > docker-bake.hcl << 'EOF'
variable "REGISTRY" {
default = "registry.example.com/lab"
}
variable "TAG" {
default = "1.0.1"
}
group "default" {
targets = ["hello-web"]
}
target "hello-web" {
context = "."
dockerfile = "Dockerfile"
tags = ["${REGISTRY}/hello-web:${TAG}"]
platforms = ["linux/amd64", "linux/arm64"]
cache-from = [{ type = "registry", ref = "${REGISTRY}/hello-web:buildcache" }]
cache-to = [{ type = "registry", ref = "${REGISTRY}/hello-web:buildcache", mode = "max" }]
secret = [{ type = "env", id = "DL_TOKEN" }]
attest = [{ type = "sbom" }]
}
EOF
docker buildx bake --builder homelab --file docker-bake.hcl --print
docker buildx bake --builder homelab --file docker-bake.hcl --push
Windows (PowerShell)#
Set-Location "$HOME\docker_volumes\buildx\project"
@'
variable "REGISTRY" {
default = "registry.example.com/lab"
}
variable "TAG" {
default = "1.0.1"
}
group "default" {
targets = ["hello-web"]
}
target "hello-web" {
context = "."
dockerfile = "Dockerfile"
tags = ["${REGISTRY}/hello-web:${TAG}"]
platforms = ["linux/amd64", "linux/arm64"]
cache-from = [{ type = "registry", ref = "${REGISTRY}/hello-web:buildcache" }]
cache-to = [{ type = "registry", ref = "${REGISTRY}/hello-web:buildcache", mode = "max" }]
secret = [{ type = "env", id = "DL_TOKEN" }]
attest = [{ type = "sbom" }]
}
'@ | Set-Content -Encoding ascii docker-bake.hcl
docker buildx bake --builder homelab --file docker-bake.hcl --print
docker buildx bake --builder homelab --file docker-bake.hcl --push
Mac (Terminal)#
Same commands as Linux.
The DL_TOKEN variable from Step 6 must still be set in this terminal. For the next release run docker buildx bake --push --var TAG=1.0.2 (the --var flag overrides a variable for one run). Without --file, Bake searches for compose.yaml and other names first and merges everything it finds, so we name the file.
Check it worked. --print shows JSON with the two platforms, the tag, the cache settings and the secret id (never its value). The --push run ends like Step 4, with the same tag pushed again, and the SBOM attached.
Tip: Bake only reads files inside the project folder by default. If a path points outside it, Bake asks for permission with
--allow fs.read=<path>. Grant the one folder you need, not*, and never run a Bake file from a stranger.
Step 8: Read the SBOM and scan it with Grype#
BuildKit makes the SBOM during the build with a Syft-based scanner (docker/buildkit-syft-scanner), in SPDX format, scanning only the final stage by default (docs). Grype can read SPDX files. Install it as in our Grype and Syft guide first.
Linux#
cd ~/docker_volumes/buildx
docker buildx imagetools inspect registry.example.com/lab/hello-web:1.0.1 \
--format '{{ json (index .SBOM "linux/arm64").SPDX }}' > logs/sbom-arm64.spdx.json
grype sbom:./logs/sbom-arm64.spdx.json
Windows (PowerShell)#
Use PowerShell 7: Windows PowerShell 5.1 saves > output as UTF-16, which Grype cannot read. The template uses a backtick string (a Go raw string), so no double quotes are needed.
Set-Location "$HOME\docker_volumes\buildx"
docker buildx imagetools inspect registry.example.com/lab/hello-web:1.0.1 --format '{{ json (index .SBOM `linux/arm64`).SPDX }}' > logs\sbom-arm64.spdx.json
grype sbom:.\logs\sbom-arm64.spdx.json
Mac (Terminal)#
Same commands as Linux.
Check it worked. The JSON file is not empty and has "spdxVersion" near the top; Grype prints findings or none. We did not run this. For the other CPU type, use amd64. Default provenance (mode=min) is safe; --provenance=mode=max also records build argument values, one more reason to keep secrets out of ARG.
Tip: Lint the Dockerfile before building with our Hadolint guide, and sign the pushed digest with Cosign.
Step 9: Run it on the Raspberry Pi and on your PC#
The Pi needs nothing but Docker and a login. Docker asks the registry for the image index and takes the entry for its own CPU.
Linux#
Run this on the Pi (64-bit OS) or on any Linux PC:
uname -m docker login registry.example.com --username change-me docker run -d --name hello-web -p 8080:8080 registry.example.com/lab/hello-web:1.0.1 curl http://localhost:8080/arch.txt
Windows (PowerShell)#
docker login registry.example.com --username change-me docker run -d --name hello-web -p 8080:8080 registry.example.com/lab/hello-web:1.0.1 curl.exe http://localhost:8080/arch.txt
Mac (Terminal)#
Same commands as Linux, without the first line.
Check it worked. On the Pi the answer is aarch64. On an Intel or AMD PC it is x86_64. An Apple Silicon Mac also prints aarch64, because Docker pulls the arm64 image there. Remove the test container with docker rm -f hello-web.
Run it in CI: Forgejo Actions or Woodpecker#
A CI job runs on a Linux runner, so there are no Windows or Mac versions. Store the registry user, password and DL_TOKEN as repository secrets, never in the file. We did not run either pipeline.
Forgejo Actions#
The job needs the Docker CLI with buildx and a reachable daemon. The official docker:29.10.1-cli image contains buildx 0.39.1 (checked in its Dockerfile). Daemon access is the runner's job: use the Docker-in-Docker setup from Forgejo's "Utilizing Docker within Actions" page (our Forgejo guide covers the runner). Save as .forgejo/workflows/image.yaml:
on:
push:
tags: ["v*"]
jobs:
image:
runs-on: docker
container:
image: docker:29.10.1-cli
steps:
- name: Install git and Node.js for the checkout action
run: apk add --no-cache git nodejs
- uses: https://data.forgejo.org/actions/checkout@v7
- name: Log in
env:
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
run: echo "$REGISTRY_PASSWORD" | docker login registry.example.com --username "$REGISTRY_USER" --password-stdin
- name: Create the builder
run: docker buildx create --name ci --driver docker-container --driver-opt image=moby/buildkit:v0.35.1 --use --bootstrap
- name: Build, push and attach the SBOM
env:
DL_TOKEN: ${{ secrets.DL_TOKEN }}
run: docker buildx bake --file docker-bake.hcl --push --var TAG=${{ forgejo.ref_name }}
Create the builder after the login, and avoid login actions that replace DOCKER_CONFIG (see Common mistakes). Docker's own GitHub actions would need a full https://github.com/... URL on Forgejo; we used plain commands instead.
Woodpecker CI#
Woodpecker has a plugin image, woodpeckerci/plugin-docker-buildx, that runs buildx. The project now lives on Codeberg; the GitHub repository is an archived mirror. The plugin starts a Docker daemon inside the step, so the step must be privileged, and your Woodpecker admin must allow exactly this image with WOODPECKER_PLUGINS_PRIVILEGED=woodpeckerci/plugin-docker-buildx:6.1.2 on the server. Save as .woodpecker/image.yaml:
when:
- event: tag
steps:
- name: image
image: woodpeckerci/plugin-docker-buildx:6.1.2
privileged: true
settings:
repo: registry.example.com/lab/hello-web
registry: registry.example.com
tags: ${CI_COMMIT_TAG}
platforms: linux/amd64,linux/arm64
cache_images:
- registry.example.com/lab/hello-web:buildcache
username:
from_secret: registry_user
password:
from_secret: registry_password
The plugin's settings (v6.1.2) include provenance but no SBOM, so for an SBOM use the Forgejo route. Setup and the Docker socket warning are in our Woodpecker CI guide.
Put it behind HTTPS with Traefik? Not for buildx#
buildx and BuildKit have no web page and publish no port, so there is nothing to put behind a proxy. What needs HTTPS is the registry you push to.
With Traefik#
No labels are needed for buildx. The registry's own Traefik labels (entrypoint https, resolver le) are in our Docker Registry guide, built on our Traefik guide.
Without Traefik: Caddy#
No reverse_proxy line is needed for buildx either. The registry guide shows Caddy with Let's Encrypt for a public domain, or tls internal at home (see our Caddy guide). For tls internal, follow the certificate authority section after Step 3.
Security and testing#
| Control | How |
|---|---|
| Builder container | The docker-container driver starts BuildKit with Privileged: true (driver source, v0.39.1). Treat a stranger's Dockerfile as code you run |
| Secrets | Secret mounts only, never ARG or ENV. Keep config/ at chmod 700 and token files at chmod 600, out of Git |
| Bake files | Releases 0.37.2 and 0.38.2 fixed file-access check bypasses. Stay on v0.38.2 or newer and grant --allow fs.read narrowly |
| Cache image | mode=max stores intermediate layers, so keep the registry private |
| Registry login | Use an account that may only push to lab/*; in CI, a secret |
| Versions | Pin moby/buildkit:v0.35.1 and CI images, never latest |
Quick tests:
docker buildx ls docker buildx inspect homelab docker logs buildx_buildkit_homelab0 --tail 50
Common mistakes#
| Mistake | Why it happens | Do this instead |
|---|---|---|
ERROR: Cache export is not supported for the docker driver. or ERROR: Attestation is not supported for the docker driver. (Azure/acr issue 775) | The default docker builder is in use | A docker-container builder (Step 2), or the containerd image store |
The same error although a docker-container builder was set up (issue 1253) | A later login action replaced DOCKER_CONFIG, so the builder settings were lost | Plain docker login, or create the builder after the login |
ERROR: docker exporter does not currently support exporting manifest lists (Pants issue 21372) | --load with two platforms: one local image cannot hold two CPU types | --push, or one platform per --load |
x509: certificate signed by unknown authority when pushing to a private registry (issue 2008) | The builder container does not use your PC's trust store | The CA in buildkitd.toml (section after Step 3) |
signal: segmentation fault (core dumped) in an emulated compile (issue 2028) | QEMU can crash on heavy work; the maintainer: "Looks like a qemu error" | A native node, or cross-compile (Performance section) |
| An arm64 image that holds amd64 files (issue 1389) | The FROM image has no arm64 variant, and the build still succeeds | docker buildx imagetools inspect <base image> first; test on the target |
ls: cannot access '/run/secrets/': No such file or directory with Compose (issue 9822) | Secrets were declared under the service, not under build | build: secrets:, plus required=true so a missing one fails loudly |
| A surprise newline in a secret from a file (issue 4267) | Editors add a line ending, and --secret passes the file as is | printf '%s' or Set-Content -NoNewline |
| Cache and image share one tag | Both write to one location, and a location holds one thing (docs warning) | Own ref for the cache, one per branch |
AI assistants: docker build --platform linux/amd64,linux/arm64 --load . on the default builder, sometimes with --cache-to type=gha and --sbom=true | They skip the builder setup, and the default builder on the old image store lacks these features | Step 2, then --push |
AI assistants: old Woodpecker plugin keys dry-run: and secrets: [..], or the archived GitHub repository | The GitHub copy of the docs is old | dry_run: and from_secret: (Codeberg docs, v6.1.2) |
AI assistants: docker buildx prune --keep-storage 10GB, or unpinned tonistiigi/binfmt as a must-have first step | Old blog advice | --reserved-space (the old flag is deprecated); a pinned binfmt only if emulation fails |
Tip: Read the error before you change anything. "docker driver" in the text always means the default builder; the fix is another builder, not another flag.
Tip: After every
docker buildx create, rundocker buildx ls. The star shows which builder your next build uses.
Troubleshooting#
| Problem | Solution |
|---|---|
| Builder does not start | docker ps -a --filter name=buildx_buildkit and docker logs buildx_buildkit_homelab0 |
Image missing from docker image ls | Expected with docker-container: it stays in the build cache unless you push, or --load one platform |
| Disk fills up | docker buildx du, then docker buildx prune --filter until=168h -f |
| Bake picks the wrong file | Name it: --file docker-bake.hcl |
Exact error texts#
ERROR: Multi-platform build is not supported for the docker driver. Switch to a different driver, or turn on the containerd image store, and try again.Same remedy as the first mistake above. From buildx's source (build/utils.go,driver/features.go); the "Cache export" and "Attestation" errors use the same template.failed to authorize: failed to fetch oauth token: ... x509: certificate signed by unknown authority(issue 2008): trust the CA inbuildkitd.toml.failed to solve: secret mysecret not found: not found(issue 9822, the maintainer's example): arequiredsecret was not passed.
Known bugs (open, December 2026)#
buildx issue 4216: since v0.37.0 a Bake target with a target: context waits for its parent build to finish. BuildKit issue 7478: with the default docker driver, deleted build-history records kept a very large amount of disk space on one host. We found nothing that stops a normal install.
Updates and backups#
Update. Read the release notes of buildx and BuildKit, change the pinned tag, and recreate the builder. Buildx itself updates with Docker's docker-buildx-plugin package on Linux, or with Docker Desktop.
docker buildx rm --keep-state homelab docker buildx create --name homelab --driver docker-container --driver-opt image=moby/buildkit:v0.35.1 --use --bootstrap docker buildx version
--keep-state keeps the builder's cache volume (docs). Windows: the same commands in PowerShell.
What to back up. Only text: project, config/buildkitd.toml and your CI files, ideally in Git. The builder cache can be rebuilt, the images live in your registry (see its guide). Keep dl_token.txt out of Git and shared backups.
Linux and Mac#
Save as ~/docker_volumes/buildx/backup.sh:
#!/usr/bin/env bash set -euo pipefail base="$HOME/docker_volumes/buildx" out="$base/backups/buildx-$(date +%F).tar.gz" tar -czf "$out" -C "$base" project chmod 600 "$out"
Run chmod 700 on it and add 0 3 * * * /home/<your-user>/docker_volumes/buildx/backup.sh with crontab -e (Mac: /Users/<your-user>/...).
Windows (PowerShell)#
$base = "$HOME\docker_volumes\buildx" $out = "$base\backups\buildx-$(Get-Date -Format yyyy-MM-dd).tar.gz" tar.exe -czf $out -C $base project
Run it daily at 03:00 in Task Scheduler: powershell.exe -NoProfile -File <full-path-to-the-script>.
Restore test#
Unpack the archive into an empty scratch folder, change into project, and run docker buildx bake --file docker-bake.hcl --print. It should print the same JSON as before.
Performance and resources#
The docs give no RAM or CPU minimum and we measured none; watch docker stats during a build. The docs name three strategies:
| Strategy | When | Cost |
|---|---|---|
| QEMU emulation | Easiest, no Dockerfile change | "Much slower than native builds", mainly for compiling |
| Native nodes | A real arm64 machine added with docker buildx create --append | You manage a second machine |
| Cross-compilation | Go, Rust and similar: FROM --platform=$BUILDPLATFORM for the build stage, TARGETARCH for the compiler | Dockerfile changes |
Pin only the build stage; the last stage must stay at the target platform. More knobs from the docs: --driver-opt memory=<size> and cpu-quota limit the builder container, max-parallelism in buildkitd.toml limits parallel steps, and [worker.oci] with gc = true and maxUsedSpace controls cleanup.
FAQ#
Is docker build the same as docker buildx build? Nearly. docker build always uses the default builder, while docker buildx build uses the one you selected (docs). With docker build, add --builder homelab.
Do I have to install QEMU? Usually not: official BuildKit releases bundle it, and Docker Desktop includes it. Use the pinned binfmt command in Step 2 only if emulation fails.
Can I build for a 32-bit Pi? Add linux/arm/v7 to the platforms (Alpine and the BuildKit image have it). Docker Engine v29 has no packages for 32-bit Pi OS, so 64-bit is the safe choice.
Can I use Docker Hub instead of my own registry? Yes. After docker login the commands are the same; give the cache its own tag.
What about Podman and Buildah? They are different tools with their own build engines: see our Podman guide and Buildah guide.
Sources#
Upgrade review, read 5 December 2026: Alpine 3.25.0 release notes.
buildx: releases (v0.39.1, 19 November 2026), README; source at v0.39.1: docker-container driver, error template, feature names. BuildKit: releases (v0.35.1, 19 November 2026), buildkitd.toml, Dockerfile reference. Both Apache-2.0
Docker docs (read 5 December 2026): drivers, docker-container driver, multi-platform, cache backends, secrets, attestations, SBOM, Bake, containerd image store, Raspberry Pi OS 32-bit notice, command references
Images and tags, checked on Docker Hub: moby/buildkit v0.35.1, tonistiigi/binfmt
qemu-v10.2.3-68, alpine 3.25.0, docker29.10.1-cliCI: Woodpecker plugin docs on Codeberg (v6.1.2), Woodpecker server settings, Forgejo Actions reference, Forgejo: Docker within Actions; Grype: scan targets
Issues read: build-push-action 1253, Azure/acr 775, Pants 21372, buildx 1389, 2008, 2028, 4209, 4216, 4267, compose 9822, BuildKit 7478
Checked against the official docs on 2026-12-05 (upgrade review; earlier setup-source dates are shown above). Nothing was run on a real machine by DIY Lab Hub; the commands come from the docs, the source and the issues above.