buildah-config(1)
buildah-config π β¨
okay bestie, welcome to the buildah-config(1) page β yeah it lives in the General Commands Manual section, and yeah it's about to be your new obsession π
β¨ NAME β¨
buildah-config β Update image configuration settings. π¦
Like. It literally goes in and tweaks the config on your image. That's the whole vibe. π
πΈ SYNOPSIS πΈ
buildah config [options] container
so it's buildah config, then whatever [options] you wanna throw at it, then the container you're messing with. easy. periodt. π
π DESCRIPTION π
Here's the tea: this command updates one or more of the settings kept for a container.</strong> π«Ά
One setting, twelve settings, honestly whatever you're feeling β it just goes in and refreshes the config, no cap. π
Also bestie, heads up: it's one or more β so don't come at me thinking you gotta do them one at a time. You don't. π₯
okay that's the setup, keep reading, there's SO much more π
π OPTIONS π
Okay bestie, here's the whole menu. Every flag, every note, no skips. Let's go. β¨
--add-historyβ drops an entry into the image's history that notes the changes you made to--cmd,--entrypoint,--env,--healthcheck,--label,--onbuild,--port,--shell,--stop-signal,--user,--volume, and--workingdir. Defaults tofalse.
Note: you can also override that default with theBUILDAH_HISTORYenvironment variable. Like:export BUILDAH_HISTORY=true
--annotation,-aannotation=annotation β adds an image annotation (thinkannotation=annotation) to the image manifest of any images that get built from this container. Use it as many times as you want. If the annotation has a trailing-, the annotation gets removed from the config. And if the annotation is literally set to-, then all annotations get yeeted from the config. π--archarchitecture β sets the target architecture for any images built from this container. By default, if the container came from an image, that image's target architecture stays; otherwise the host's architecture gets recorded. π¦--authorauthor β sets the contact info for the author on any images built from this container.--cmdcommand β sets the default command to run for containers based on any images built from this container. When you pair it with an entry point, this is what specifies the default parameters for that entry point. π--commentcomment β sets the image-level comment for any images built from this container.
Note: this setting isn't in the OCIv1 image format, so it gets discarded when writing images in OCIv1 formats.
--created-bycreated β sets the description of how the topmost layer was created, for any images created from this container.--domainnamedomain β sets the domainname to use when running containers based on any images built from this container.
Note: this setting isn't in the OCIv1 image format, so it gets discarded when writing images in OCIv1 formats.
--entrypoint "command" | '["command", "arg1", ...]'β sets the entry point for containers based on any images built from this container.buildahsupports two formats here, bestie: a plain string, or an array of commands.
Note: when the entrypoint is a string, container runtimes will ignore thecmdvalue of the container image. But if you use the array form, thecmdgets appended onto the end of the entrypoint cmd and they get executed together.
Note: the string form gets appended to the sh -c command as the entrypoint. The array form replaces the entrypoint entirely.
String Format:
$ buildah from scratch
$ buildah config --entrypoint "/usr/bin/notashell" working-container
$ buildah inspect --format '{{ .OCIv1.Config.Entrypoint }}' working-container
[/bin/sh -c /usr/bin/notshell]
$ buildah inspect --format '{{ .Docker.Config.Entrypoint }}' working-container
[/bin/sh -c /usr/bin/notshell]
Array Format:
$ buildah config --entrypoint '["/usr/bin/notashell"]' working-container
$ buildah inspect --format '{{ .OCIv1.Config.Entrypoint }}' working-container
[/usr/bin/notashell]
$ buildah inspect --format '{{ .Docker.Config.Entrypoint }}' working-container
[/usr/bin/notashell]
--env,-eenv[=value] β adds a value (likeenv=value) to the environment for containers based on any images built from this container. Can be used multiple times. If env is named but you give it neither=nor a value, the value gets pulled from the current process environment. If env has a trailing-, that env gets removed from the config. And if env is set to-, then all environment variables get removed from the config. π§--healthcheckcommand β specifies a command that should run to check whether a container is running correctly.
Values can be NONE, "CMD ..." (run that command directly), "CMD-SHELL ..." (run that command using the system's shell), or the empty value (which removes a previously-set value and its related settings).
Note: this setting isn't in the OCIv1 image format, so it gets discarded when writing images in OCIv1 formats.
--healthcheck-intervalinterval β specifies how often the command from the--healthcheckoption should run.
Note: this setting isn't in the OCIv1 image format, so it gets discarded when writing images in OCIv1 formats.
--healthcheck-retriescount β specifies how many times the command from the--healthcheckoption can fail before the container is considered unhealthy.
Note: this setting isn't in the OCIv1 image format, so it gets discarded when writing images in OCIv1 formats.
--healthcheck-start-intervalinterval β specifies the time between health checks during the start period.
Note: this setting isn't in the OCIv1 image format, so it gets discarded when writing images in OCIv1 formats.
--healthcheck-start-periodinterval β specifies how much time can elapse after a container has started before a failure to run the command from the--healthcheckoption should be treated as a sign that the container is failing. During this window, failures get blamed on the container not having fully started yet and won't count as errors. After the command succeeds, or the time period has elapsed, failures start counting as errors. π
Note: this setting isn't in the OCIv1 image format, so it gets discarded when writing images in OCIv1 formats.
--healthcheck-timeoutinterval β specifies how long to wait after starting the command from the--healthcheckoption for it to return its exit status. If the command hasn't returned within this time, it should be considered to have failed.
Note: this setting isn't in the OCIv1 image format, so it gets discarded when writing images in OCIv1 formats.
--history-commentcomment β sets a comment on the topmost layer of any images created from this container.--hostnamehost β sets the hostname to use when running containers based on any images built from this container.
Note: this setting isn't in the OCIv1 image format, so it gets discarded when writing images in OCIv1 formats.
--label,-llabel=value β adds an image label (likelabel=value) to the image configuration of any images built from this container. Can be used multiple times. If label has a trailing-, the label gets removed from the config. If label is set to-, then all labels get removed from the config. β¨--onbuildonbuild command β adds anONBUILDcommand to the image.ONBUILDcommands run automatically when images get built based on the image you're creating. π€―
Note: this setting isn't in the OCIv1 image format, so it gets discarded when writing images in OCIv1 formats.
--osoperating system β sets the target operating system for any images built from this container. By default, if the container came from an image, its OS is kept; otherwise the host's OS name gets recorded.--os-featurefeature β sets the name of a required operating system feature for any images built from this container. By default, if the container came from an image, the base image's required OS feature list is kept β if it specified one. This option is typically only meaningful when the image's OS is Windows.
If feature has a trailing -, the feature gets removed from the set of required features that'll be listed in the image. If feature is set to -, then the entire features list gets removed from the config.
--os-versionversion β sets the exact required operating system version for any images built from this container. By default, if the container came from an image, the base image's required OS version is kept β if it specified one. This option is typically only meaningful when the image's OS is Windows, and it's typically set in Windows base images, so using this option is usually unnecessary. π--port,-pport/protocol β adds a port to expose when running containers based on any images built from this container. Can be used multiple times. To say whether the port listens on TCP or UDP, useport/protocol. The default is TCP if you don't specify a protocol. To expose the port on both TCP and UDP, specify the port option multiple times. If port has a trailing-and is already set, the port gets removed from the configuration. If port is set to-, then all exposed ports settings get removed from the configuration. π₯--shellshell β sets the default shell to run inside the container image. The shell instruction lets the default shell used for the shell form of commands be overridden. The default shell for Linux containers is/bin/sh -c. π
Note: this setting isn't in the OCIv1 image format, so it gets discarded when writing images in OCIv1 formats.
--stop-signalsignal β sets the default stop signal for the container. This signal gets sent when the container is stopped; the default isSIGINT.--unsetannotationannotation β unsets the image annotation, so it doesn't get inherited from the base image.--unsetlabellabel β unsets the image label, so it doesn't get inherited from the base image.--user,-uuser[:group] β sets the default user to use when running containers based on this image. The user can be a user name or UID, optionally followed by a group name or GID, separated by a colon (:). If you use names, the container should include entries for those names in its/etc/passwdand/etc/groupfiles. π«Ά--variantvariant β sets the target architecture variant for any images built from this container. By default, if the container came from an image, that image's target architecture and variant info is kept; otherwise the host's architecture and variant get recorded. π--volume,-vvolume β adds a location in the directory tree that should be marked as a volume in any images built from this container. Can be used multiple times. If volume has a trailing-and is already set, the volume gets removed from the config. If volume is set to-, then all volumes get removed from the config. π--workingdirdirectory β sets the initial working directory for containers based on images built from this container.
πΈ EXAMPLE πΈ
okay bestie, here's the part where we just show you, because honestly? reading is hard and doing is slay. every single one of these goes in a code block, character-for-character, no edits, no cap π
buildah config --author='Jane Austen' --workingdir='/etc/mycontainers'
containerID
author gets set to Jane Austen (a literal icon, she ate) and the working dir gets set to /etc/mycontainers. yes the containerID is on its own line up there β that's just how it wrapped, don't come for me π
buildah config --entrypoint /entrypoint.sh containerID
setting an entrypoint the chill way, as one plain string. simple. clean. iconic β¨
buildah config --entrypoint '[ "/entrypoint.sh", "dev" ]' containerID
and here's the JSON-array form of the same thing, because sometimes you need the whole posse (/entrypoint.sh plus the arg dev) showing up together π«Ά
buildah config --env foo=bar --env PATH=$PATH containerID
stacking env vars, one after the other. foo=bar and PATH pulls whatever $PATH is in your shell rn β so like, it's giving "inherited", okay? π
buildah config --env foo- containerID
not me removing foo entirely just by slapping a - at the end π that trailing dash is the unset move, fr fr.
buildah config --label Name=Mycontainer --label Version=1.0 containerID
two labels, one command. yes there are two spaces before Version in the original and yes we are keeping them, we don't touch the sacred text π
buildah config --label Name- containerID
and boom, Name label deleted, same trailing-dash energy as the env one. it's giving "be gone" π
buildah config --annotation note=myNote containerID
adding an annotation note set to myNote. annotations are the lowkey mysterious sibling of labels, iykyk π
buildah config --annotation note-
removing that annotation. heads up bestie β this one has no containerID in the original example, so that's exactly what we're showing. don't add one, don't remove one, we keep it real π
buildah config --volume /usr/myvol containerID
declaring /usr/myvol as a volume, aka "this spot is for storing stuff, bestie" π
buildah config --volume /usr/myvol- containerID
and un-declaring it with the dash. the dash is truly the main character of this whole page π
buildah config --port 1234 --port 8080 containerID
two ports, both plain numbers, both just... exposed. no protocol drama πΈ
buildah config --port 514/tcp --port 514/udp containerID
same port number 514 but for tcp and udp β she contains multitudes π
buildah config --env 1234=5678 containerID
numbers as an env var name, living their best numeric life. valid, apparently. slay π₯
buildah config --env 1234- containerID
and unsetting the numeric one. dash stays undefeated β
buildah config --os-version 10.0.19042.1645 containerID
setting the OS version to 10.0.19042.1645. look at all those lil numbers, so specific π
buildah config --os-feature win32k containerID
adding the win32k OS feature β¨
buildah config --os-feature win32k- containerID
and removing it. dash. again. always the dash. periodt π
π¦ SEE ALSO π¦
buildah(1)β the mothership, the origin story, go read her π
that's the whole page, bestie!! you made it to the end and honestly? obsessed with you π₯Ήπ
this lil masterpiece lives in the buildah source, and the page itself is dated March 2017 β a classic, a timeless queen π go forth and configure your containers, you absolute legend π§π
π¦ 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.41.5-1.fc43 Β· 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