buildah(1)
โจ NAME โจ
buildah โ a command line tool that facilitates building OCI container images. ๐
(also hi, this is the buildah(1) page from the General Commands Manual, so you're literally in the right place bestie ๐ซถ)
๐ธ SYNOPSIS ๐ธ
buildah [OPTIONS] COMMAND [ARG...]
๐ DESCRIPTION ๐
okay so the Buildah package hands you a command line tool that can do all of this:
- Create a working container, either from scratch or using an image as a starting point.
- Mount a working container's root filesystem for manipulation.
- Unmount a working container's root filesystem.
- Use the updated contents of a container's root filesystem as a filesystem layer to create a new image.
- Delete a working container or an image.
- Rename a local container.
like, that's the whole glow-up pipeline. container in, image out. iconic behavior honestly ๐
๐ OPTIONS ๐
--cgroup-manager=managerโ the CGroup manager to use for container cgroups. Supported values arecgroupfsorsystemd. Default issystemdunless it's overridden in thecontainers.conffile.- Note: setting this flag can cause certain commands to break when called on containers that were previously created by the other CGroup manager type. ๐ญ
- Note: CGroup manager is not supported in rootless mode when using CGroups Version V1.
--imagestorepath โ the path under which content for pulled and built images will be stored. By default, the configured--rootlocation is used for pulled and built images as well as containers. If the storage driver isoverlay, then any images which have previously been written to the--rootlocation will still be available.
This will override the imagestore option in containers-storage.conf(5).
--log-levellevel โ the log level to be used. Either"trace","debug","info","warn","error","fatal", or"panic", defaulting to"warn".--help,-hโ show help ๐โโ๏ธ--registries-confpath โ pathname of the configuration file which specifies which container registries should be consulted when completing image names which do not include a registry or domain portion. It is not recommended that this option be used, as the default behavior of using the system-wide configuration (/etc/containers/registries.conf) is most often preferred.--registries-conf-dirpath โ pathname of the directory which contains configuration snippets which specify registries which should be consulted when completing image names which do not include a registry or domain portion. It is not recommended that this option be used, as the default behavior of using the system-wide configuration (/etc/containers/registries.d) is most often preferred.--rootpath โ storage root dir (default:"/var/lib/containers/storage"for UID 0,"$HOME/.local/share/containers/storage"for other users). The default root dir is configured in/etc/containers/storage.conf.--runrootpath โ storage state dir (default:"/run/containers/storage"for UID 0,"/run/user/$UID"for other users). The default state dir is configured in/etc/containers/storage.conf.--short-name-alias-confpath โ pathname of the file which contains cached mappings between short image names and their corresponding fully-qualified names. It is used for mapping from names of images specified using short names like"ubi8"which don't include a registry component and a corresponding fully-specified name which includes a registry and any other components, such as"registry.access.redhat.com/ubi8". It is not recommended that this option be used, as the default behavior of using the system-wide cache (/var/cache/containers/short-name-aliases.conf) or per-user cache ($HOME/.cache/containers/short-name-aliases.conf) to supplement system-wide defaults is most often preferred.--storage-drivervalue โ storage driver. The default storage driver for UID 0 is configured in/etc/containers/storage.conf($HOME/.config/containers/storage.confin rootless mode), and isvfsfor other users. TheSTORAGE_DRIVERenvironment variable overrides the default. The--storage-driverspecified driver overrides all. ๐ซก
Examples: "overlay", "vfs"
Overriding this option will cause thestorage-optsettings in/etc/containers/storage.confto be ignored. The user must specify additional options via the--storage-optflag.
--storage-optvalue โ storage driver option. Default storage driver options are configured in/etc/containers/storage.conf($HOME/.config/containers/storage.confin rootless mode). TheSTORAGE_OPTSenvironment variable overrides the default. The--storage-optspecified options overrides all.--transient-storebool-value โ store metadata about containers under the storage state directory (--runroot), with the intention that records about them will be removed when the system is rebooted. Additional garbage collection must still be performed at boot-time, so this option should remain disabled in most configurations. (default:false)--userns-gid-mapmapping โ directly specifies a GID mapping which should be used to set ownership, at the filesystem level, on the working container's contents. Commands run when handling RUN instructions will default to being run in their own user namespaces, configured using the UID and GID maps.
Entries in this map take the form of one or more colon-separated triples of a starting in-container GID, a corresponding starting host-level GID, and the number of consecutive IDs which the map entry represents.
This option overrides the remap-gids setting in the options section of /etc/containers/storage.conf.
If this option is not specified, but a global --userns-gid-map setting is supplied, settings from the global option will be used.
If none of --userns-uid-map-user, --userns-gid-map-group, or --userns-gid-map are specified, but --userns-uid-map is specified, the GID map will be set to use the same numeric values as the UID map.
NOTE: When this option is specified by a rootless user, the specified mappings are relative to the rootless usernamespace in the container, rather than being relative to the host as it would be when run rootful.
--userns-uid-mapmapping โ directly specifies a UID mapping which should be used to set ownership, at the filesystem level, on the working container's contents. Commands run when handling RUN instructions will default to being run in their own user namespaces, configured using the UID and GID maps.
Entries in this map take the form of one or more colon-separated triples of a starting in-container UID, a corresponding starting host-level UID, and the number of consecutive IDs which the map entry represents.
This option overrides the remap-uids setting in the options section of /etc/containers/storage.conf.
If this option is not specified, but a global --userns-uid-map setting is supplied, settings from the global option will be used.
If none of --userns-uid-map-user, --userns-gid-map-group, or --userns-uid-map are specified, but --userns-gid-map is specified, the UID map will be set to use the same numeric values as the GID map.
NOTE: When this option is specified by a rootless user, the specified mappings are relative to the rootless usernamespace in the container, rather than being relative to the host as it would be when run rootful.
--version,-vโ print the version ๐ข
๐ฆ Environment Variables ๐ฆ
Buildah can set up environment variables from the env entry in the [engine] table in the containers.conf(5). These variables can be overridden by passing environment variables before the buildah commands. ๐ซ
part 2 is loading, don't go anywhere bestie ๐
๐ COMMANDS ๐
okay bestie, this is the part you actually came for ๐
โ the whole roster of stuff buildah can do. Every single one of these lives in its own man page, so when you wanna go deep, just pull up that page and I promise it's worth it. Here's the lineup, in order, no skips, no cuts:
addโ page:buildah-add(1)โจ โ Add the contents of a file, URL, or a directory to the container.buildโ page:buildah-build(1)๐ฅ โ Builds an OCI image using instructions in one or more Containerfiles. this one is THE moment, lowkey the whole reason we're here.commitโ page:buildah-commit(1)๐ โ Create an image from a working container.configโ page:buildah-config(1)๐ โ Update image configuration settings.containersโ page:buildah-containers(1)๐ธ โ List the working containers and their base images.copyโ page:buildah-copy(1)๐ฆ โ Copies the contents of a file, URL, or directory into a container's working directory.fromโ page:buildah-from(1)โญ โ Creates a new working container, either from scratch or using a specified image as a starting point. your origin story fr fr.imagesโ page:buildah-images(1)๐ โ List images in local storage.infoโ page:buildah-info(1)๐ โ Display Buildah system information.inspectโ page:buildah-inspect(1)๐ โ Inspects the configuration of a container or image.loginโ page:buildah-login(1)๐ โ Login to a container registry.logoutโ page:buildah-logout(1)๐ โ Logout of a container registry.manifestโ page:buildah-manifest(1)๐ง โ Create and manipulate manifest lists and image indexes.mkcwโ page:buildah-mkcw(1)๐ โ Convert a conventional container image into a confidential workload image.mountโ page:buildah-mount(1)๐ โ Mount the working container's root filesystem.pruneโ page:buildah-prune(1)๐งน โ Cleanup intermediate images as well as build and mount cache. self-care for your storage, honestly.pullโ page:buildah-pull(1)๐ซถ โ Pull an image from the specified location.pushโ page:buildah-push(1)๐ โ Push an image from local storage to elsewhere.renameโ page:buildah-rename(1)โ๏ธ โ Rename a local container.rmโ page:buildah-rm(1)๐ โ Removes one or more working containers.rmiโ page:buildah-rmi(1)๐ โ Removes one or more images.runโ page:buildah-run(1)โก โ Run a command inside of the container.sourceโ page:buildah-source(1)๐ฆ โ Create, push, pull and manage source images and associated source artifacts.tagโ page:buildah-tag(1)๐ท๏ธ โ Add an additional name to a local image.umountโ page:buildah-umount(1)๐ โ Unmount a working container's root file system.unshareโ page:buildah-unshare(1)๐ โ Launch a command in a user namespace with modified ID mappings.versionโ page:buildah-version(1)๐ โ Display the Buildah Version Information.
no cap, that's the full set of commands โ twenty-seven of them, each with its own whole man page waiting for you. go off ๐
๐ธ FILES ๐ธ
okay bestie, this is the part where we talk about the little config files that run the whole show behind the scenes. they're not glamorous but they're everything. ๐
๐พ storage.conf (/etc/containers/storage.conf)
storage.conf is the storage configuration file for all tools using containers/storage. periodt.
it specifies all of the available container storage options for tools using shared container storage. all of them. the whole buffet. ๐
๐พ mounts.conf (/usr/share/containers/mounts.conf and optionally /etc/containers/mounts.conf)
so the mounts.conf files list volume mount files or directories that get automatically mounted inside containers when you run buildah run or buildah build. ๐ซถ container processes can then use that content. and here's the key thing โ the volume mount content does not get committed to the final image.
usually these directories are used for passing secrets or credentials that the package software needs to access remote package repositories. iykyk ๐
for example, a mounts.conf with the line "/usr/share/rhel/secrets:/run/secrets" means the content of the /usr/share/rhel/secrets directory gets mounted on /run/secrets inside the container. this mountpoint lets Red Hat Enterprise Linux subscriptions from the host be used within the container. iconic behaviour honestly.
you can also omit the destination if it's equal to the source path. for example, specifying /var/lib/secrets will mount the directory into the same container destination path /var/lib/secrets. no cap.
๐จ note note note: this is not a volume mount. the content of the volumes is copied into container storage, not bind mounted directly from the host. don't get it twisted bestie.
๐พ registries.conf (/etc/containers/registries.conf)
registries.conf is the configuration file that specifies which container registries should be consulted when completing image names that don't include a registry or domain portion. it's giving "where do i look when you're vague" energy. ๐
๐พ registries.d (/etc/containers/registries.d)
a directory containing configuration snippets which specify registries which should be consulted when completing image names which do not include a registry or domain portion. yes, it's basically the same job as registries.conf but as a directory of lil snippets. both exist. both matter. ๐
โจ SEE ALSO โจ
go read these too, they're the supporting cast and they ate:
containers.conf(5)containers-mounts.conf(5)newuidmap(1)newgidmap(1)containers-registries.conf(5)containers-storage.conf(5)
๐ HISTORY ๐
December 2017, Originally compiled by Tom Sweeney tsweeney@redhat.com โจmailto:tsweeney@redhat.comโฉ
and that's the whole page bestie!! ๐ this buildah manual page is from March 2017, page buildah(1) โ go forth and build containers, you absolute main character. slay responsibly. ๐โจ๐ฆ
๐ฆ where this page comes from
- centos-stream 10: buildah 2:1.45.0-2.el10 ยท Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0
- centos-stream 9: buildah 2:1.43.2-3.el9 ยท Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0
- fedora 43: buildah 2:1.43.2-1.fc43
- fedora 43: buildah 2:1.43.4-1.fc43
- fedora 43: buildah 2:1.43.5-1.fc43 ยท Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0
- fedora 44: buildah 2:1.43.0-1.fc44 ยท Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0
- fedora 44: buildah 2:1.43.4-1.fc44
- fedora 44: buildah 2:1.43.5-1.fc44 ยท Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms