Build from a file
buildah build -t <image> .
Build an image from a Containerfile
buildah build -f <file> -t <image>
<dir>
Use a specific Containerfile and context
buildah build --build-arg <k>=<v> .
Set a build argument
buildah build --layers .
Cache intermediate layers (off by default)
Without --layers only the final layer is created, so repeat
builds redo every step. BUILDAH_LAYERS=true sets it
permanently.
buildah build --no-cache .
Ignore cached layers
buildah build --target <stage> .
Stop at a named stage
buildah build --platform <os/arch> .
Build for another platform
buildah build --format docker .
Docker manifest instead of OCI
The default is oci; docker format is needed for HEALTHCHECK
and SHELL to be kept.
buildah build --pull=always .
Always refresh base images
buildah build --secret id=<id>,src=<file>
.
Pass a secret to RUN mounts
buildah build --platform <list> --manifest
<list> .
Multi-arch build into a manifest list
Add content
buildah copy <ctr> <src> <dest>
Copy files into the container
buildah copy --chown <user>:<group> <ctr>
<src> <dest>
Set owner while copying
buildah copy --from <image> <ctr> <src>
<dest>
Copy from another image or container
buildah add <ctr> <url|archive>
<dest>
Copy, fetching URLs and unpacking archives
buildah mount <ctr>
Print the container root filesystem path
buildah unshare
Shell in a rootless user namespace
buildah unshare --mount <var>=<ctr> --
<cmd>
Mount a container and export its path
buildah config --entrypoint '<json-array>'
<ctr>
Set the entrypoint
buildah config --cmd '<cmd>'
<ctr>
Set the default command
buildah config --env <k>=<v> <ctr>
Set an environment variable
buildah config --port <port>/tcp <ctr>
Declare an exposed port
buildah commit <ctr> <image>
Create an image from the container
buildah commit --rm <ctr> <image>
Commit, then delete the container
buildah commit --format docker <ctr>
<image>
Docker format instead of OCI
Images and registries
buildah images
List local images
buildah inspect <name>
Show config of a container or image
buildah pull <image>
Fetch an image into local storage
buildah push <image> <dest>
Push to a registry or other transport
buildah push <image>
docker://<registry>/<repo>:<tag>
Push to a registry explicitly
buildah push <image>
oci-archive:<file>.tar:<tag>
Export as an OCI archive
buildah tag <image> <new-name>
Add another name to an image
buildah rmi <image>
Remove an image
buildah login <registry>
Log in to a registry
buildah push --tls-verify=false <image>
<dest>
Skip TLS verification (testing only)