$linuxjunkies
>

buildah(1)

Build OCI container images using rootless or root commands without requiring a daemon.

UbuntuDebianFedoraArch

Synopsis

buildah COMMAND [OPTIONS] [ARG...]

Description

Buildah is a tool for building Open Container Initiative (OCI) compliant container images. It allows you to build images from Dockerfiles or using a series of buildah commands, and works without requiring a Docker daemon running in the background.

Buildah can run rootless (as a regular user) on systems with proper user namespace support, making it safer for automated and multi-tenant environments. Images built with buildah are fully compatible with Docker, Podman, and other OCI-compliant container runtimes.

Common options

FlagWhat it does
--helpShow help information for the command or subcommand
--versionDisplay buildah version information
-f, --filePath to Dockerfile (used with bud command)
-t, --tagName and optionally a tag for the built image
--build-argSet build-time variables (passed to FROM base image)
--layersCache intermediate layers during build (default true)
--quietSuppress output of successful commands
--isolationType of isolation (oci, chroot, rootless) for the build environment
--formatImage format (docker, oci) for output image
--pullPull base image even if cached locally

Examples

Build an image from a Dockerfile in the current directory, tagging it as myapp:latest

buildah bud -f Dockerfile -t myapp:latest .

Create a new build container based on the alpine:latest image

buildah from alpine:latest

Run a command inside an existing build container to install packages

buildah run mycontainer apk add --no-cache nginx

Copy files from the host into a build container

buildah copy mycontainer /local/app /app

Set the entrypoint for a build container

buildah config --entrypoint '["nginx"]' mycontainer

Commit a build container to create a new image

buildah commit mycontainer myimage:v1.0

Build an image passing build arguments that can be used in Dockerfile

buildah bud --build-arg VERSION=1.0 -t app:1.0 .

List all images available to buildah

buildah images

Related commands