Buildah serves as a command-line tool for creating Open Container Initiative (OCI) images compatible with Docker, Kubernetes, and other container systems. Unlike Docker, it operates without requiring a daemon, offering a lightweight alternative for container image creation.
Why Use Buildah?
- Daemon-less: Operates without a daemon, enhancing security and reducing resource overhead
- Flexibility: Integrates seamlessly with existing CI/CD pipelines
- Multi-Arch Support: Enables building images for different architectures without separate configurations
Installing Buildah
On Ubuntu systems, installation requires:
sudo apt-get update
sudo apt-get install -y buildah qemu-user-static
For other distributions, consult the official Buildah installation documentation.
Building Multi-Architecture Images
Step 1: Set Up QEMU
Enable cross-architecture building using QEMU emulation:
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
Alternatively, with Podman:
podman run --rm --privileged multiarch/qemu-user-static --reset -p yes
Step 2: Prepare Your Dockerfile
Create a Dockerfile for your application. Example using Alpine Linux with development tools:
FROM alpine:3.20.0
RUN apk add --no-cache \
bash \
curl \
wget \
vim \
nano \
htop \
tcpdump \
nmap \
git \
jq \
netcat-openbsd \
bind-tools \
traceroute
CMD ["/bin/bash"]
Step 3: Build Images for Each Architecture
Generate separate images for both amd64 and arm64:
# Build image for amd64
buildah bud --arch amd64 -f Dockerfile -t dimjones/toolbox:amd64 .
# Build image for arm64
buildah bud --arch arm64 -f Dockerfile -t dimjones/toolbox:arm64 .
Step 4: Create a Multi-Architecture Manifest
Combine both architecture images into a single manifest:
# Create a new manifest
buildah manifest create dimjones/toolbox:latest
# Add the images to the manifest
buildah manifest add dimjones/toolbox:latest dimjones/toolbox:amd64
buildah manifest add dimjones/toolbox:latest dimjones/toolbox:arm64
Step 5: Push the Multi-Architecture Image
Upload the multi-architecture manifest to your Docker registry:
buildah manifest push --all dimjones/toolbox:latest docker://dimjones/toolbox:latest
Conclusion
Buildah enables efficient multi-architecture container image creation without Docker’s daemon dependency. This approach streamlines builds, reduces system dependencies, and eliminates the security overhead of running a daemon — making it ideal for cloud and edge computing environments.