AdvancedLesson 18 of 26
BuildKit, buildx and multi-platform images
Faster builds, cache control and images for both Intel and ARM.
BuildKit is Docker's modern builder (the default today). buildx exposes its extra features.
bash
docker buildx create --use
docker buildx build --platform linux/amd64,linux/arm64 -t myuser/myapp:1.0 --push .
docker buildx build --cache-to type=registry,ref=myuser/cache --cache-from type=registry,ref=myuser/cache .- Multi-platform images let one tag run on a laptop (ARM Mac) and a server (x86).
- Cache mounts keep package caches between builds:
RUN --mount=type=cache,target=/root/.cache/pip pip install ....