Advanced
Searching inInstall guides
How to search
  • Paste an error message in quotes, e.g. "permission denied", to find the fix table that explains it.
  • Choose an area and a part of the guide (install, first settings, daily use, security, fixes) to go straight to the right step.
  • "two words" finds the exact phrase.
  • Plain words find names, texts and examples.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search
Try:

Guide 94Buildah / Skopeo · Containers

Install and use Buildah and Skopeo (images without Docker)

Buildah builds OCI container images without a daemon and without root — ideal for CI runners where Docker-in-Docker or the Docker socket would be a security risk. Skopeo inspects, copies, syncs and deletes images directly between registries, without pulling them to a local engine — ideal for promotion between registries, mirroring for air-gapped networks and checking digests. Both are part of RHEL's container tools (with Podman). This guide installs them, builds images the Containerfile way and the scripted way, runs them in CI, and uses Skopeo for daily registry work.

  • 10 Lessons
  • 5 Commands

$ run as a normal user# run as root (or with sudo)

94.1

Know it before you install

Buildah creates a working container from a base image, changes it (run commands, copy files, set config) and commits it as an image — or simply builds a Containerfile/Dockerfile. Skopeo talks to registries with transports: docker:// (a registry), oci:/dir: (local folders), oci-archive:/docker-archive: (tar files), containers-storage: (Podman/Buildah storage).

ItemValue
PackagesRHEL: buildah, skopeo (or container-tools); Ubuntu: buildah, skopeo
Registry logins${XDG_RUNTIME_DIR}/containers/auth.json (shared with Podman)
Registries config/etc/containers/registries.conf
Storagerootless: ~/.local/share/containers/storage
Signing policy/etc/containers/policy.json

94.2

Install on RHEL, Rocky, Alma and Fedora

dnf -y install buildah skopeo
buildah version
skopeo --version

94.3

Install on Ubuntu and Debian

apt-get update
apt-get install -y buildah skopeo uidmap

Rootless use needs sub-UIDs for your user (see the Podman guide: /etc/subuid, /etc/subgid).

94.4

First configuration: log in and build

buildah login harbor.example.com
buildah build -t harbor.example.com/shop/api:1.4.0 -f Containerfile .
buildah images
buildah push harbor.example.com/shop/api:1.4.0

A small, safe image (multi-stage, non-root user):

Containerfile
FROM registry.access.redhat.com/ubi9/python-312 AS build
WORKDIR /opt/app-root/src
COPY requirements.txt .
RUN pip install --no-cache-dir --target /opt/deps -r requirements.txt
COPY app/ app/
 
FROM registry.access.redhat.com/ubi9/python-312
COPY --from=build /opt/deps /opt/deps
COPY --from=build /opt/app-root/src/app /opt/app-root/src/app
ENV PYTHONPATH=/opt/deps
USER 1001
EXPOSE 8080
CMD ["python", "-m", "app"]

The scripted way — useful when you do not want a Containerfile, or need logic between steps:

ctr=$(buildah from registry.access.redhat.com/ubi9/ubi-minimal)
buildah run $ctr -- microdnf -y install nginx
buildah run $ctr -- microdnf clean all
buildah copy $ctr ./site /usr/share/nginx/html
buildah config --port 8080 --user nginx --cmd "nginx -g 'daemon off;'" --label org.opencontainers.image.source=https://github.com/ORG/site $ctr
buildah commit --rm $ctr harbor.example.com/web/site:1.0.0

94.5

Buildah in CI (no privileges)

In a container-based CI job (GitLab, GitHub, Tekton), Buildah runs without --privileged with the chroot isolation and the vfs storage driver:

.gitlab-ci.yml
build-image:
  stage: build
  image: quay.io/buildah/stable
  variables:
    STORAGE_DRIVER: vfs
    BUILDAH_ISOLATION: chroot
  script:
    - buildah login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
    - buildah build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" .
    - buildah push --digestfile digest.txt "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA"
  artifacts:
    paths: [digest.txt]

--digestfile saves the pushed digest — sign and scan exactly that digest in the next jobs.

94.6

Skopeo: inspect, copy, sync

skopeo inspect docker://docker.io/library/nginx:1.27 | jq '.Digest, .Created, .Architecture'
skopeo inspect --format '{{.Digest}}' docker://harbor.example.com/shop/api:1.4.0
skopeo list-tags docker://harbor.example.com/shop/api
skopeo copy --all docker://docker.io/library/nginx:1.27 docker://harbor.example.com/mirror/nginx:1.27
skopeo copy docker://harbor.example.com/shop/api:1.4.0 docker://harbor.example.com/shop-prod/api:1.4.0
skopeo copy docker://docker.io/library/alpine:3.22 oci-archive:alpine-3.22.tar
skopeo sync --src docker --dest dir docker.io/library/redis:7 /srv/mirror/
skopeo delete docker://harbor.example.com/shop/api:old-test
CommandUse
inspectDigest, labels, architecture — without pulling.
copy --allCopy every architecture of a multi-arch image.
copy between projectsPromote a tested image from staging to prod registry (same digest).
copy … oci-archive: / sync … dirMove images into air-gapped networks.
deleteRemove a tag/manifest from a registry.

Real uses at work:

  • Rootless, daemonless image builds in CI and on RHEL servers.
  • Promotion of tested images between registries; mirroring public images to Harbor/Nexus.
  • Air-gapped clusters: export to archives, import on the other side.

94.7

Make it safe

Security checklist:

  • Build rootless and without --privileged (chroot isolation in CI).
  • Fully qualified base images (registry.access.redhat.com/ubi9/..., docker.io/library/...), pinned tags or digests.
  • Non-root USER, multi-stage builds, no secrets in layers (use --secret for build-time secrets).
  • Push by digest, then scan (Trivy) and sign (Cosign) that digest.
  • Registry credentials only from CI secrets; auth.json private.
  • Use policy.json to require signatures for production registries where possible.

94.8

Update and remove

dnf -y upgrade buildah skopeo
apt-get install --only-upgrade -y buildah skopeo
buildah rm --all && buildah rmi --prune

94.9

Fix common problems

ProblemCauseFix
short-name resolution enforced but cannot promptBase image without a registry name.Use the full name (docker.io/library/…).
cannot clone: Operation not permitted / user namespaces errors in CIThe runner blocks user namespaces.BUILDAH_ISOLATION=chroot, STORAGE_DRIVER=vfs; or allow user namespaces on the runner.
there might not be enough IDs availableNo sub-UIDs for the user.Add /etc/subuid and /etc/subgid entries; podman system migrate.
unauthorized: authentication requiredNot logged in, or another auth file.buildah login / skopeo login; check REGISTRY_AUTH_FILE.
manifest unknownWrong tag or the image has only other architectures.skopeo list-tags; skopeo inspect --raw to see the manifest list.
Build very slow in CIvfs storage copies every layer.Normal for vfs; use overlay with fuse-overlayfs when the runner allows it; cache base images.

94.10

Next steps

1Why use Buildah instead of Docker-in-Docker in CI?

Buildah needs no daemon and no privileged container, so a job can not take over the runner host.

2How do you move a tested image from the staging to the production registry without rebuilding it?

All commands in this chapter