๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout Register Now โ†’
Menu

Categories

๐Ÿณ Containers September 2, 2026 3

Linux Command: buildah

Build OCI container images without a daemon

Terminal โ€” Containers
Command
$ ctr=$(buildah from alpine:3.19) && buildah run $ctr apk add --no-cache python3 pip && buildah copy $ctr ./app /app && buildah config --cmd "python3 /app/main.py" --port 8080 $ctr && buildah commit $ctr myapp:latest

The buildah command builds OCI and Docker container images without requiring a running daemon. Part of the Podman container ecosystem developed by Red Hat, Buildah provides fine-grained control over the image build process โ€” either using standard Dockerfiles or through scripted builds that manipulate container layers directly. Buildah is particularly valuable in CI/CD pipelines where running a Docker daemon is impractical or a security concern. It can build images as a regular user (rootless), does not require any long-running background process, and produces images compatible with Docker, Podman, Kubernetes, and any OCI-compliant runtime. While podman build uses Buildah internally for Dockerfile-based builds, the buildah CLI adds unique capabilities: scripted builds without Dockerfiles, mounting container filesystems on the host, fine-grained layer control, and the ability to build from scratch (empty) images. This makes Buildah ideal for creating minimal, optimized container images for production.

Syntax

buildah [OPTIONS] COMMAND [ARG...]

Key Options

  • from โ€” Create a working container from a base image
  • run โ€” Run a command inside the working container
  • copy โ€” Copy files into the working container
  • config โ€” Set image configuration (CMD, ENV, EXPOSE, etc.)
  • commit โ€” Create an image from a working container
  • bud (build-using-dockerfile) โ€” Build image from Dockerfile

Examples

Scripted build (no Dockerfile)

ctr=$(buildah from alpine:3.19) && buildah run $ctr apk add --no-cache python3 pip && buildah copy $ctr ./app /app && buildah config --cmd "python3 /app/main.py" --port 8080 $ctr && buildah commit $ctr myapp:latest

Build from Dockerfile

buildah bud -t myapp:v1.0 --layers --target production .

Build from scratch (empty image)

ctr=$(buildah from scratch) && mnt=$(buildah mount $ctr) && cp mybinary $mnt/ && buildah config --cmd "/mybinary" $ctr && buildah commit $ctr minimal:latest

Pro Tips

  • Buildah builds images without a daemon or root privileges โ€” perfect for CI/CD pipelines (GitHub Actions, GitLab CI, Jenkins) where running dockerd is impractical.
  • podman build is a wrapper around Buildah for Dockerfile builds. Use buildah directly when you need scripted builds, filesystem mounting, or building from scratch.
  • Working containers created with buildah from are temporary. Always commit (buildah commit) before removing them, or your work is lost.

Learn more: Full buildah reference โ†’

Share this tip