Skip to main content
๐ŸŽ“ Claude Code Masterclass Learn AI-assisted development on Udemy โ€” plus the companion book on Leanpub & Amazon. Start Learning
Buildah Cheat Sheet 2026: Container Image Build Commands
DevOps

Buildah Cheat Sheet 2026: Container Image Build Commands

Buildah cheat sheet for 2026. Build, push, mount, copy, and create rootless OCI container images without a daemon. Dockerfile and scripted build workflows.

LB
Luca Berton
ยท 1 min read

A quick reference for Buildah โ€” daemonless OCI container image building. Bookmark this page.

Build from Containerfile

# Build image (like docker build)
buildah bud -t myapp:v1 .
buildah bud -t myapp:v1 -f Containerfile .

# Build with arguments
buildah bud --build-arg VERSION=3.11 -t myapp:v1 .

# Multi-stage build
buildah bud --layers -t myapp:v1 .

# Build without cache
buildah bud --no-cache -t myapp:v1 .

# Build for different platform
buildah bud --platform linux/arm64 -t myapp:v1-arm .

Manual Image Building (No Dockerfile)

# Create a working container from base image
container=$(buildah from fedora:39)

# Run commands inside
buildah run $container -- dnf install -y nginx
buildah run $container -- dnf clean all

# Copy files into container
buildah copy $container ./app /opt/app
buildah copy $container nginx.conf /etc/nginx/nginx.conf

# Set configuration
buildah config --port 80 $container
buildah config --entrypoint '["/usr/sbin/nginx", "-g", "daemon off;"]' $container
buildah config --env APP_ENV=production $container
buildah config --label maintainer="luca@lucaberton.com" $container
buildah config --workingdir /opt/app $container
buildah config --user nginx $container

# Commit to image
buildah commit $container myapp:v1

# Clean up
buildah rm $container

Image Management

# List images
buildah images

# Inspect image
buildah inspect --type image myapp:v1

# Tag image
buildah tag myapp:v1 registry.example.com/myapp:v1

# Push to registry
buildah push myapp:v1 docker://registry.example.com/myapp:v1

# Push to Docker daemon
buildah push myapp:v1 docker-daemon:myapp:v1

# Remove image
buildah rmi myapp:v1

# Pull image
buildah pull docker.io/library/nginx:alpine

Container Management

# List working containers
buildah containers

# Mount container filesystem
mountpoint=$(buildah mount $container)
echo "Filesystem at: $mountpoint"
ls $mountpoint/etc/

# Unmount
buildah unmount $container

# Remove all containers
buildah rm -a

Tips and Tricks

  • Buildah does not need a daemon โ€” perfect for CI/CD and rootless builds
  • Use buildah bud for Dockerfile/Containerfile builds (compatible with Docker)
  • Use manual building for fine-grained control and smaller images
  • Combine with Podman: podman build uses Buildah under the hood
  • Use --squash to merge layers and reduce image size

Free 30-min AI & Cloud consultation

Book Now