Skip to content
saurabhahuja71Public

About

Multi-arch Docker tutorial: build amd64/arm64 Hello World images with buildah manifests

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Multi-Arch Docker Tutorial: Build a Hello World Image for amd64 & arm64 (buildah)

Multi-architecture Docker tutorial showing how to compile a tiny C Hello World, build linux/amd64 and linux/arm64 container images with buildah, create a manifest list, and push a multi-arch image. Great companion lab for Python/Go students learning containers and Apple Silicon / cloud ARM.

Cross-track lab (Containers) linked from the Python and Cloud paths · Time: ~45–90 minutes · Level: intermediate beginner

What is this project?

Piece Role
hello.c Static-friendly Hello World in C
Dockerfile Container build definition
README commands buildah multi-arch + manifest workflow

SEO keywords: multi arch docker tutorial, buildah multi-architecture image, docker manifest amd64 arm64, static binary container hello world, build multi-platform container from scratch.

Prerequisites

  • Linux host (or VM) with buildah (and typically podman)
  • gcc for local static build experiments
  • Container registry account if you push (Docker Hub, Quay, etc.)
  • Basic Docker/Podman knowledge

Quick start — local binary

git clone https://github.com/saurabhahuja71/hello.git
cd hello

gcc -static -o hello hello.c
./hello
# Hello, World!

Static linking helps minimal/scratch-style images.

Multi-arch image with buildah

Adjust image names to your registry namespace.

# Build per-architecture images (example tags)
buildah build --platform linux/amd64 -t docker.io/YOURUSER/hello:v1.0-amd64 .
buildah build --platform linux/arm64 -t docker.io/YOURUSER/hello:v1.0-arm64 .

buildah inspect docker.io/YOURUSER/hello:v1.0-arm64

# Create and fill a manifest list
buildah manifest create docker.io/YOURUSER/hello:v1.0
buildah manifest add docker.io/YOURUSER/hello:v1.0 docker.io/YOURUSER/hello:v1.0-amd64
buildah manifest add docker.io/YOURUSER/hello:v1.0 docker.io/YOURUSER/hello:v1.0-arm64

buildah manifest inspect docker.io/YOURUSER/hello:v1.0

# Push all architectures
buildah manifest push --all docker.io/YOURUSER/hello:v1.0 \
  "docker://docker.io/YOURUSER/hello:v1.0"

Original sample commands used docker.io/sauraahu/hello:… as an example remote — replace with your account.

Docker Buildx alternative

docker buildx create --use
docker buildx build --platform linux/amd64,linux/arm64 \
  -t docker.io/YOURUSER/hello:v1.0 --push .

What you will learn

  • Why multi-arch images matter (Intel laptops vs Graviton/Raspberry Pi)
  • Difference between a single-arch tag and a manifest list
  • Static binaries vs distro-heavy images
  • Registry push workflows for portable demos

Lab exercises

  1. Change the message in hello.c, rebuild both arches, re-push.
  2. Run the arm64 image on an arm64 host (or emulator) and amd64 on x86.
  3. Rewrite the Dockerfile as multi-stage: build with gcc, run on scratch or alpine.
  4. Add a GitHub Actions workflow with docker/build-push-action matrices.
  5. Compare image sizes: static C vs python:slim “hello”.

Learning path links

Track Related labs
Containers / K8s react-fastapi-todo Compose · helidon-cloudnative-microservice-sample
Python apps Ship FastAPI/Flask images using the same multi-arch ideas
Hub learning-path

FAQ — Multi-arch containers

Do I need two physical machines?
No. buildah/buildx can cross-build; you still should test on real hardware when possible.

buildah vs docker build?
Both can produce OCI images. buildah is common on Podman/RHEL-style setups.

Is C required for Python students?
Only for this tiny demo. The manifest skill transfers to any language image.

Topics / SEO tags

docker buildah multi-arch arm64 amd64 containers oci manifest-list tutorial devops hello-world c

Author

Saurabh Ahuja · learning-path

License

Educational sample.

About

Multi-arch Docker tutorial: build amd64/arm64 Hello World images with buildah manifests

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages