Building container images has become a daily task for developers, DevOps engineers, and platform teams. While [docker](https://www.docker.com/) build is the most well-known approach, it requires a running Docker daemon and root-level privileges — both of which create security and architectural concerns in production CI/CD environments.
Enter a new generation of self-hosted container build tools that eliminate the daemon dependency, improve reproducibility, and integrate seamlessly into automated pipelines. In this guide, we’ll compare three leading options: Buildah, Kaniko, and Earthly — examining their architectures, features, installation processes, and ideal use cases.
Why Self-Host Your Container Build Pipeline?
Running container builds on your own infrastructure offers several advantages over managed or SaaS build services:
- Security and Compliance: Build artifacts never leave your network. For regulated industries (finance, healthcare, government), this is non-negotiable.
- Cost Control: SaaS build minutes add up quickly. A self-hosted build runner with caching costs a fraction of commercial alternatives.
- No Daemon Dependency: Traditional
docker buildrequires the Docker daemon (root access, socket exposure). Modern tools use rootless builds or run containers-within-containers safely. - Full Pipeline Control: Customize caching strategies, base image registries, build environments, and retention policies without vendor lock-in.
- Air-Gapped Support: Self-hosted tools work in offline environments where no internet access is available for pulling base images or pushing results.
Now let’s examine each tool in depth.
Buildah: The Daemonless Dockerfile Builder
Buildah is developed by Red Hat and forms the core of the Podman container ecosystem. It specializes in building OCI-compliant container images from Dockerfiles — without requiring a Docker daemon.
Key Features
- Daemonless architecture: No background service required; each
buildahinvocation is independent - Rootless builds: Full support for unprivileged users building images
- Dockerfile compatibility: Drop-in replacement for
docker buildin most cases - Multi-stage builds: Full support for complex multi-stage Dockerfiles
- Image manipulation: Push, pull, mount, unmount, and modify images directly from the command line
- OCI compliance: Produces standard OCI images compatible with any runtime
Installation
Fedora / RHEL / CentOS:
| |
Ubuntu / Debian:
| |
macOS (via Homebrew):
| |
From Source:
| |
Building Your First Image
| |
Advanced: Scripting Image Creation
Buildah’s unique strength is its ability to build images using shell scripts instead of Dockerfiles:
| |
This scripting approach gives you full programmatic control — conditionals, loops, and external tool integration work naturally.
Performance and Caching
Buildah uses the containers/storage backend with layer-level caching. Subsequent builds skip unchanged layers automatically:
| |
Kaniko: Build Images in Kubernetes, No Daemon Required
Kaniko, developed by Google, is designed specifically for building container images inside Kubernetes clusters — or any environment where running a Docker daemon is impractical or forbidden.
Key Features
- No Docker daemon: Runs entirely in userspace; extracts the base filesystem and executes Dockerfile commands as a series of snapshots
- Kubernetes-native: Designed to run as a Kubernetes Job or Pod
- Registry-agnostic: Pushes to any OCI-compliant registry (Docker Hub, Harbor, ECR, GCR, GHCR)
- Snapshot-based layering: After each Dockerfile command, Kaniko snapshots the filesystem changes and creates a new layer
- Warmer cache: Pre-downloads base images to speed up builds in cluster environments
- Security isolation: Each build runs in its own Pod with configurable resource limits and network policies
Installation
Kaniko doesn’t require installation in the traditional sense — you run it as a container image. Here’s how to use it in different contexts.
As a Kubernetes Job
| |
With Docker (for testing)
| |
Local Binary (Standalone)
| |
Build Contexts
Kaniko supports multiple context sources:
| |
Performance Tuning
| |
Earthly: Reproducible Builds with Buildkit and Makefile-Like Syntax
Earthly takes a fundamentally different approach. Instead of simply building Dockerfiles, it provides a build automation system with its own syntax (Earthfile) inspired by Makefiles and Dockerfiles. It runs on top of BuildKit and is designed for reproducible, CI-friendly builds.
Key Features
- Earthfile syntax: Combines the best of Makefiles and Dockerfiles — targets, dependencies, and artifact passing
- Reproducible builds: Same build, same result, every time — across machines and CI systems
- CI/CD integration: First-class support for GitHub Actions, GitLab CI, Jenkins, CircleCI, and more
- Satellite builds (optional): Optional managed build runners for speed; self-hosted mode uses local BuildKit
- Artifact sharing: Easily pass build outputs between targets and save them to local files
- Multi-platform builds: Build for linux/amd64, linux/arm64, and other architectures simultaneously
- Secret management: Built-in SSH and secret passing without baking credentials into images
Installation
Linux (one-liner):
| |
macOS:
| |
From Source:
| |
Writing Your First Earthfile
Create a file named Earthfile in your project root:
| |
Running Builds
| |
Multi-Target Dependencies
Earthfile targets can depend on each other, creating a build graph:
| |
| |
Head-to-Head Comparison
| Feature | Buildah | Kaniko | Earthly |
|---|---|---|---|
| Developer | Red Hat | Earthly Technologies | |
| Daemon Required | No | No | No (uses BuildKit) |
| Dockerfile Support | Full | Full | Via IMPORT directive |
| Own Build Syntax | No (scripts or Dockerfile) | No (Dockerfile only) | Yes (Earthfile) |
| Rootless Builds | Yes | Yes | Yes |
| Kubernetes Native | No | Yes | Partial |
| CI/CD Integration | CLI-based | Job/Pod-based | First-class |
| Caching | Layer-level (containers/storage) | Snapshot-level (registry cache) | BuildKit cache + remote |
| Multi-Platform | Limited | No | Yes (buildx-compatible) |
| Artifact Sharing | Manual | No | Built-in (SAVE ARTIFACT) |
| Secret Management | Mount-based | Volume-based | Built-in (–secret flag) |
| Language | Go | Go | Go |
| License | Apache 2.0 | Apache 2.0 | Mozilla Public License 2.0 |
| GitHub Stars | ~8.6K | ~10.8K | ~14K+ |
| Registry Push | Yes | Yes | Yes |
| Air-Gapped Builds | Yes | Yes | Yes (with local cache) |
Choosing the Right Tool
Choose Buildah when:
- You want a drop-in replacement for
docker buildwith minimal learning curve - Your team works in a Red Hat / Podman ecosystem
- You need scriptable image creation using shell commands instead of Dockerfiles
- You want rootless builds on a single host without Kubernetes
- You need to modify existing images (mount, inspect, re-tag) without rebuilding from scratch
Typical deployment: Install on developer laptops and CI runners alongside Podman. Use Buildah in CI scripts as a direct substitute for docker build.
Choose Kaniko when:
- You’re building inside Kubernetes clusters (GitLab runners, Tekton pipelines, Argo Workflows)
- You cannot run a Docker daemon for security or policy reasons
- You need cloud-storage context sources (GCS, S3, Azure Blob)
- You want per-Pod build isolation with resource limits and network policies
- Your CI system is Kubernetes-native (no VM-based runners available)
Typical deployment: Deploy as a Kubernetes Job triggered by webhooks or CI pipeline steps. Each build runs in an isolated Pod with its own resource quota.
Choose Earthly when:
- You need complex, multi-stage builds with dependencies between targets
- Reproducibility across developer machines and CI systems is critical
- You want Makefile-like build orchestration with Docker-compatible execution
- You build for multiple architectures (amd64, arm64) from a single command
- Your build process involves compiling, testing, linting, and packaging in a unified pipeline
- You need artifact passing between build stages without manual file copying
Typical deployment: Install earthly binary on CI runners. Commit Earthfile to the repository. Trigger builds via CI pipelines with earthly --ci +target.
Production CI/CD Integration Examples
GitHub Actions with Buildah
| |
GitLab CI with Kaniko
| |
Jenkins with Earthly
| |
Security Considerations
All three tools improve security over traditional docker build in different ways:
| Concern | Buildah | Kaniko | Earthly |
|---|---|---|---|
| Root daemon exposure | Eliminated | Eliminated | Eliminated |
| Socket mount required | No | No | No |
| Namespace isolation | Yes (Podman namespaces) | Yes (Pod isolation) | Yes (BuildKit sandboxes) |
| Build context tampering | Filesystem ACLs | Pod security policies | Read-only source mount |
| Credential leakage | BuildKit secret mount | Volume mount (scoped) | Built-in –secret |
| Supply chain attestations | Via cosign/sigstore | Via cosign/sigstore | Built-in provenance |
For maximum security, combine any of these tools with image signing (cosign), SBOM generation (syft), and vulnerability scanning (Trivy) in your pipeline.
Final Verdict
Each tool excels in its own domain:
Buildah is the pragmatic choice for teams already using Podman or who want a daemonless
docker buildreplacement. Its scripting capabilities make it uniquely flexible for non-standard build workflows.Kaniko is the Kubernetes specialist. If your CI runs inside a cluster and you can’t run Docker, Kaniko is purpose-built for exactly this scenario. Its snapshot-based approach is reliable and well-tested at Google-scale.
Earthly is the build orchestration powerhouse. When your builds involve compilation, testing, linting, multi-platform targets, and artifact sharing, Earthfile’s dependency graph and reproducible execution save hours of debugging broken CI pipelines.
The best approach for many organizations is not picking one but combining them: use Buildah on developer workstations, Kaniko for Kubernetes-native CI, and Earthly for complex multi-service builds. All three produce OCI-compliant images, so the outputs are interchangeable regardless of which tool created them.
Frequently Asked Questions (FAQ)
Which one should I choose in 2026?
The best choice depends on your specific requirements:
- For beginners: Start with the simplest option that covers your core use case
- For production: Choose the solution with the most active community and documentation
- For teams: Look for collaboration features and user management
- For privacy: Prefer fully open-source, self-hosted options with no telemetry
Refer to the comparison table above for detailed feature breakdowns.
Can I migrate between these tools?
Most tools support data import/export. Always:
- Backup your current data
- Test the migration on a staging environment
- Check official migration guides in the documentation
Are there free versions available?
All tools in this guide offer free, open-source editions. Some also provide paid plans with additional features, priority support, or managed hosting.
How do I get started?
- Review the comparison table to identify your requirements
- Visit the official documentation (links provided above)
- Start with a Docker Compose setup for easy testing
- Join the community forums for troubleshooting