2018-03-20 17:41:19 +08:00
# buildah-commit "1" "March 2017" "buildah"
2017-03-29 03:37:24 +08:00
## NAME
2018-04-26 21:01:15 +08:00
buildah\-commit - Create an image from a working container.
2017-03-29 03:37:24 +08:00
## SYNOPSIS
2019-11-19 04:40:43 +08:00
**buildah commit** [*options*] *container* [*image*]
2017-03-29 03:37:24 +08:00
## DESCRIPTION
2017-04-14 03:42:04 +08:00
Writes a new image using the specified container's read-write layer and if it
2018-06-30 03:39:36 +08:00
is based on an image, the layers of that image. If *image* does not begin
2019-11-19 04:40:43 +08:00
with a registry name component, `localhost` will be added to the name. If
2020-07-29 22:45:17 +08:00
*image* is not provided, the image will have no name. When an image has no
name, the `buildah images` command will display `<none>` in the `REPOSITORY` and
`TAG` columns.
2017-03-29 03:37:24 +08:00
2024-01-08 22:58:08 +08:00
The *image* value supports all transports from `containers-transports(5)` . If no transport is specified, the `containers-storage` (i.e., local storage) transport is used.
2023-12-17 20:00:58 +08:00
2018-04-11 01:07:31 +08:00
## RETURN VALUE
The image ID of the image that was created. On error, 1 is returned and errno is returned.
2017-03-29 03:37:24 +08:00
## OPTIONS
2023-12-13 03:54:42 +08:00
**--add-file** *source[:destination]*
Read the contents of the file `source` and add it to the committed image as a
file at `destination` . If `destination` is not specified, the path of `source`
will be used. The new file will be owned by UID 0, GID 0, have 0644
2025-04-30 04:37:27 +08:00
permissions, and be given the timestamp specified to the ** --timestamp** option
if it is specified. This option can be specified multiple times.
2023-12-13 03:54:42 +08:00
2025-06-21 03:05:20 +08:00
**--annotation** *annotation[=value]*
Add an image *annotation* (e.g. annotation=*value*) to the image metadata. Can be used multiple times.
If *annotation* is named, but neither `=` nor a `value` is provided, then the *annotation* is set to an empty value.
Note: this information is not present in Docker image formats, so it is discarded when writing images in Docker formats.
2018-01-31 08:19:30 +08:00
**--authfile** *path*
2024-01-26 04:50:33 +08:00
Path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json. See containers-auth.json(5) for more information. This file is created using `buildah login` .
2021-04-30 03:36:15 +08:00
2018-01-31 08:19:30 +08:00
If the authorization state is not found there, $HOME/.docker/config.json is checked, which is set using `docker login` .
2021-04-30 03:36:15 +08:00
Note: You can also override the default path of the authentication file by setting the REGISTRY\_AUTH\_FILE
environment variable. `export REGISTRY_AUTH_FILE=path`
2017-08-25 05:44:32 +08:00
**--cert-dir** *path*
2018-05-02 03:37:13 +08:00
Use certificates at *path* (\*.crt, \*.cert, \*.key) to connect to the registry.
2020-09-09 16:25:25 +08:00
The default certificates directory is _/etc/containers/certs.d_ .
2017-08-25 05:44:32 +08:00
2023-11-01 22:18:40 +08:00
**--change**, ** -c** *"INSTRUCTION"*
Apply the change to the committed image that would have been made if it had
been built using a Containerfile which included the specified instruction.
This option can be specified multiple times.
**--config** *filename*
Read a JSON-encoded version of an image configuration object from the specified
file, and merge the values from it with the configuration of the image being
committed.
2025-06-21 03:05:20 +08:00
**--created-annotation**
Add an image *annotation* (see also ** --annotation**) to the image metadata
setting "org.opencontainers.image.created" to the current time, or to the
datestamp specified to the ** --source-date-epoch** or ** --timestamp** flag,
if either was used. If *false* , no such annotation will be present in the
written image.
Note: this information is not present in Docker image formats, so it is discarded when writing images in Docker formats.
2017-08-25 05:44:32 +08:00
**--creds** *creds*
2018-01-25 06:49:37 +08:00
The [username[:password]] to use to authenticate with the registry if required.
If one or both values are not supplied, a command line prompt will appear and the
value can be entered. The password is entered without echo.
2017-08-25 05:44:32 +08:00
2023-07-26 06:17:33 +08:00
**--cw** *options*
Produce an image suitable for use as a confidential workload running in a
trusted execution environment (TEE) using krun (i.e., *crun* built with the
libkrun feature enabled and invoked as *krun* ). Instead of the conventional
contents, the root filesystem of the image will contain an encrypted disk image
and configuration information for krun.
The value for *options* is a comma-separated list of key=value pairs, supplying
configuration information which is needed for producing the additional data
which will be included in the container image.
Recognized _keys_ are:
*attestation_url*: The location of a key broker / attestation server.
If a value is specified, the new image's workload ID, along with the passphrase
used to encrypt the disk image, will be registered with the server, and the
server's location will be stored in the container image.
At run-time, krun is expected to contact the server to retrieve the passphrase
using the workload ID, which is also stored in the container image.
If no value is specified, a *passphrase* value *must* be specified.
*cpus*: The number of virtual CPUs which the image expects to be run with at
run-time. If not specified, a default value will be supplied.
*firmware_library*: The location of the libkrunfw-sev shared library. If not
specified, `buildah` checks for its presence in a number of hard-coded
locations.
*memory*: The amount of memory which the image expects to be run with at
run-time, as a number of megabytes. If not specified, a default value will be
supplied.
*passphrase*: The passphrase to use to encrypt the disk image which will be
included in the container image.
If no value is specified, but an *attestation_url* value is specified, a
randomly-generated passphrase will be used.
The authors recommend setting an *attestation_url* but not a *passphrase* .
*slop*: Extra space to allocate for the disk image compared to the size of the
container image's contents, expressed either as a percentage (..%) or a size
value (bytes, or larger units if suffixes like KB or MB are present), or a sum
of two or more such specifications separated by "+". If not specified,
`buildah` guesses that 25% more space than the contents will be enough, but
this option is provided in case its guess is wrong. If the specified or
computed size is less than 10 megabytes, it will be increased to 10 megabytes.
*type*: The type of trusted execution environment (TEE) which the image should
be marked for use with. Accepted values are "SEV" (AMD Secure Encrypted
Virtualization - Encrypted State) and "SNP" (AMD Secure Encrypted
Virtualization - Secure Nested Paging). If not specified, defaults to "SNP".
*workload_id*: A workload identifier which will be recorded in the container
image, to be used at run-time for retrieving the passphrase which was used to
encrypt the disk image. If not specified, a semi-random value will be derived
from the base image's image ID.
New CI check: xref --help vs man pages
Run 'buildah --help', recursively against all subcommands,
then cross-reference the results against docs/buildah*.md.
Report differences in subcommands and/or flags.
The majority of the changes in this PR are trivial (see
below) but a handful may be controversial and require
careful review:
* Making 'bud' the default output of 'buildah help',
with 'build-using-dockerfile' as an alias. This is
the inverse of the situation until now: buildah
would list build-using-dockerfile as the primary
name. The man page, OTOH, lists 'bud'. The source
file name is 'bud'. I suspect that most people
type 'bud'. So, for consistency, I choose to make
'bud' the default visible command.
* add --encryption-key and --encrypt-layer documentation
to buildah-commit.md, and --encrypt-layer to -push.md.
Please double-check the wording here.
* remove --notruncate from buildah-images.md. The option
does not exist (although there is a TODO comment in
the code). If it should exist, it is left to the
reader to implement. I would humbly suggest that this
is a good idea, for consistency with buildah containers.
* remove --shm-size from buildah-pull.md. The option
does not exist, and I suspect this was a copy-paste error.
* remove --security-opt from run.go. It was unimplemented
and undocumented.
* remove --userns-[gu]id-map from buildah-bud.md. These
are global options, not bud options, and are documented
well enough in buildah.bud.
Trivial (IMO) changes:
* split options in man pages, from '**--foo, -f**'
to '**--foo**, **-f**'. This conforms with the style
used in podman man pages.
* add missing one-letter aliases (usually "-q", "-a")
* add missing man page entries for some easy options
* sort out-of-order subcommand listings in man pages
Finally, do note that this is a copy-and-alter duplicate of the
original script in podman, and that is horrible. In an ideal
world I would've been able to refactor the podman version into
something usable on both repos (and then more). It turns out the
differences in man page format and in special-case handling are
too broad to let me do a clean refactor.
Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-09-21 22:51:19 +08:00
**--disable-compression**, ** -D**
2017-03-29 03:37:24 +08:00
2018-06-06 22:41:40 +08:00
Don't compress filesystem layers when building the image unless it is required
by the location where the image is being written. This is the default setting,
because image layers are compressed automatically when they are pushed to
registries, and images being written to local storage would only need to be
decompressed again to be stored. Compression can be forced in all cases by
specifying ** --disable-compression=false**.
2017-04-14 03:42:04 +08:00
New CI check: xref --help vs man pages
Run 'buildah --help', recursively against all subcommands,
then cross-reference the results against docs/buildah*.md.
Report differences in subcommands and/or flags.
The majority of the changes in this PR are trivial (see
below) but a handful may be controversial and require
careful review:
* Making 'bud' the default output of 'buildah help',
with 'build-using-dockerfile' as an alias. This is
the inverse of the situation until now: buildah
would list build-using-dockerfile as the primary
name. The man page, OTOH, lists 'bud'. The source
file name is 'bud'. I suspect that most people
type 'bud'. So, for consistency, I choose to make
'bud' the default visible command.
* add --encryption-key and --encrypt-layer documentation
to buildah-commit.md, and --encrypt-layer to -push.md.
Please double-check the wording here.
* remove --notruncate from buildah-images.md. The option
does not exist (although there is a TODO comment in
the code). If it should exist, it is left to the
reader to implement. I would humbly suggest that this
is a good idea, for consistency with buildah containers.
* remove --shm-size from buildah-pull.md. The option
does not exist, and I suspect this was a copy-paste error.
* remove --security-opt from run.go. It was unimplemented
and undocumented.
* remove --userns-[gu]id-map from buildah-bud.md. These
are global options, not bud options, and are documented
well enough in buildah.bud.
Trivial (IMO) changes:
* split options in man pages, from '**--foo, -f**'
to '**--foo**, **-f**'. This conforms with the style
used in podman man pages.
* add missing one-letter aliases (usually "-q", "-a")
* add missing man page entries for some easy options
* sort out-of-order subcommand listings in man pages
Finally, do note that this is a copy-and-alter duplicate of the
original script in podman, and that is horrible. In an ideal
world I would've been able to refactor the podman version into
something usable on both repos (and then more). It turns out the
differences in man page format and in special-case handling are
too broad to let me do a clean refactor.
Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-09-21 22:51:19 +08:00
**--encrypt-layer** *layer(s)*
Layer(s) to encrypt: 0-indexed layer indices with support for negative indexing (e.g. 0 is the first layer, -1 is the last layer). If not defined, will encrypt all layers if encryption-key flag is specified.
2022-03-24 20:03:06 +08:00
**--encryption-key** *key*
The [protocol:keyfile] specifies the encryption protocol, which can be JWE (RFC7516), PGP (RFC4880), and PKCS7 (RFC2315) and the key material required for image encryption. For instance, jwe:/path/to/key.pem or pgp:admin@example.com or pkcs7:/path/to/x509-file.
New CI check: xref --help vs man pages
Run 'buildah --help', recursively against all subcommands,
then cross-reference the results against docs/buildah*.md.
Report differences in subcommands and/or flags.
The majority of the changes in this PR are trivial (see
below) but a handful may be controversial and require
careful review:
* Making 'bud' the default output of 'buildah help',
with 'build-using-dockerfile' as an alias. This is
the inverse of the situation until now: buildah
would list build-using-dockerfile as the primary
name. The man page, OTOH, lists 'bud'. The source
file name is 'bud'. I suspect that most people
type 'bud'. So, for consistency, I choose to make
'bud' the default visible command.
* add --encryption-key and --encrypt-layer documentation
to buildah-commit.md, and --encrypt-layer to -push.md.
Please double-check the wording here.
* remove --notruncate from buildah-images.md. The option
does not exist (although there is a TODO comment in
the code). If it should exist, it is left to the
reader to implement. I would humbly suggest that this
is a good idea, for consistency with buildah containers.
* remove --shm-size from buildah-pull.md. The option
does not exist, and I suspect this was a copy-paste error.
* remove --security-opt from run.go. It was unimplemented
and undocumented.
* remove --userns-[gu]id-map from buildah-bud.md. These
are global options, not bud options, and are documented
well enough in buildah.bud.
Trivial (IMO) changes:
* split options in man pages, from '**--foo, -f**'
to '**--foo**, **-f**'. This conforms with the style
used in podman man pages.
* add missing one-letter aliases (usually "-q", "-a")
* add missing man page entries for some easy options
* sort out-of-order subcommand listings in man pages
Finally, do note that this is a copy-and-alter duplicate of the
original script in podman, and that is horrible. In an ideal
world I would've been able to refactor the podman version into
something usable on both repos (and then more). It turns out the
differences in man page format and in special-case handling are
too broad to let me do a clean refactor.
Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-09-21 22:51:19 +08:00
**--format**, ** -f** *[oci | docker]*
2017-05-18 05:02:40 +08:00
Control the format for the image manifest and configuration data. Recognized
formats include *oci* (OCI image-spec v1.0, the default) and *docker* (version
2, using schema format 2 for the manifest).
2023-12-01 04:43:59 +08:00
Note: You can also override the default format by setting the BUILDAH_FORMAT
environment variable. `export BUILDAH_FORMAT=docker`
2018-06-01 22:26:34 +08:00
2022-04-04 13:37:01 +08:00
**--identity-label** *bool-value*
2025-05-15 04:57:01 +08:00
Adds a label `io.buildah.version` with its value set to the version of buildah
which committed the image (default true unless `--timestamp` or
`--source-date-epoch` is used).
2022-04-04 13:37:01 +08:00
2018-04-25 22:00:46 +08:00
**--iidfile** *ImageIDfile*
Write the image ID to the file.
2021-08-11 06:11:15 +08:00
**--manifest** "listName"
2020-12-30 20:16:24 +08:00
2021-08-11 06:11:15 +08:00
Name of the manifest list to which the built image will be added. Creates the manifest list
2020-12-30 20:16:24 +08:00
if it does not exist. This option is useful for building multi architecture images.
2022-06-01 15:59:52 +08:00
**--omit-history** *bool-value*
Omit build history information in the built image. (default false).
This option is useful for the cases where end users explicitly
want to set `--omit-history` to omit the optional `History` from
built images or when working with images built using build tools that
do not include `History` information in their images.
2023-12-05 03:05:38 +08:00
**--pull**
When the *--pull* flag is enabled or set explicitly to `true` (with
*--pull=true*), attempt to pull the latest versions of SBOM scanner images from
the registries listed in registries.conf if a local SBOM scanner image does not
exist or the image in the registry is newer than the one in local storage.
Raise an error if the SBOM scanner image is not in any listed registry and is
not present locally.
If the flag is disabled (with *--pull=false* ), do not pull SBOM scanner images
from registries, use only local versions. Raise an error if a SBOM scanner
image is not present locally.
If the pull flag is set to `always` (with *--pull=always* ), pull SBOM scanner
images from the registries listed in registries.conf. Raise an error if a SBOM
scanner image is not found in the registries, even if an image with the same
name is present locally.
If the pull flag is set to `missing` (with *--pull=missing* ), pull SBOM scanner
images only if they could not be found in the local containers storage. Raise
an error if no image could be found and the pull fails.
If the pull flag is set to `never` (with *--pull=never* ), do not pull SBOM
scanner images from registries, use only the local versions. Raise an error if
the image is not present locally.
New CI check: xref --help vs man pages
Run 'buildah --help', recursively against all subcommands,
then cross-reference the results against docs/buildah*.md.
Report differences in subcommands and/or flags.
The majority of the changes in this PR are trivial (see
below) but a handful may be controversial and require
careful review:
* Making 'bud' the default output of 'buildah help',
with 'build-using-dockerfile' as an alias. This is
the inverse of the situation until now: buildah
would list build-using-dockerfile as the primary
name. The man page, OTOH, lists 'bud'. The source
file name is 'bud'. I suspect that most people
type 'bud'. So, for consistency, I choose to make
'bud' the default visible command.
* add --encryption-key and --encrypt-layer documentation
to buildah-commit.md, and --encrypt-layer to -push.md.
Please double-check the wording here.
* remove --notruncate from buildah-images.md. The option
does not exist (although there is a TODO comment in
the code). If it should exist, it is left to the
reader to implement. I would humbly suggest that this
is a good idea, for consistency with buildah containers.
* remove --shm-size from buildah-pull.md. The option
does not exist, and I suspect this was a copy-paste error.
* remove --security-opt from run.go. It was unimplemented
and undocumented.
* remove --userns-[gu]id-map from buildah-bud.md. These
are global options, not bud options, and are documented
well enough in buildah.bud.
Trivial (IMO) changes:
* split options in man pages, from '**--foo, -f**'
to '**--foo**, **-f**'. This conforms with the style
used in podman man pages.
* add missing one-letter aliases (usually "-q", "-a")
* add missing man page entries for some easy options
* sort out-of-order subcommand listings in man pages
Finally, do note that this is a copy-and-alter duplicate of the
original script in podman, and that is horrible. In an ideal
world I would've been able to refactor the podman version into
something usable on both repos (and then more). It turns out the
differences in man page format and in special-case handling are
too broad to let me do a clean refactor.
Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-09-21 22:51:19 +08:00
**--quiet**, ** -q**
2017-09-22 17:37:40 +08:00
When writing the output image, suppress progress output.
2025-04-30 04:37:27 +08:00
**--rewrite-timestamp**
When generating the new layer for the image, ensure that no newly added content
bears a timestamp later than the value used by the ** --source-date-epoch**
flag, if one was provided, by replacing any timestamps which are later than
that value, with that value.
2017-07-14 20:57:26 +08:00
**--rm**
2020-07-29 22:45:17 +08:00
Remove the working container and its contents after creating the image.
2017-07-14 20:57:26 +08:00
Default leaves the container and its content in place.
2023-12-05 03:05:38 +08:00
**--sbom** *preset*
Generate SBOMs (Software Bills Of Materials) for the output image by scanning
the working container and build contexts using the named combination of scanner
image, scanner commands, and merge strategy. Must be specified with one or
more of ** --sbom-image-output**, ** --sbom-image-purl-output**, ** --sbom-output**,
and ** --sbom-purl-output**. Recognized presets, and the set of options which
they equate to:
- "syft", "syft-cyclonedx":
--sbom-scanner-image=ghcr.io/anchore/syft
--sbom-scanner-command="/syft scan -q dir:{ROOTFS} --output cyclonedx-json={OUTPUT}"
--sbom-scanner-command="/syft scan -q dir:{CONTEXT} --output cyclonedx-json={OUTPUT}"
--sbom-merge-strategy=merge-cyclonedx-by-component-name-and-version
- "syft-spdx":
--sbom-scanner-image=ghcr.io/anchore/syft
--sbom-scanner-command="/syft scan -q dir:{ROOTFS} --output spdx-json={OUTPUT}"
--sbom-scanner-command="/syft scan -q dir:{CONTEXT} --output spdx-json={OUTPUT}"
--sbom-merge-strategy=merge-spdx-by-package-name-and-versioninfo
- "trivy", "trivy-cyclonedx":
--sbom-scanner-image=ghcr.io/aquasecurity/trivy
--sbom-scanner-command="trivy filesystem -q {ROOTFS} --format cyclonedx --output {OUTPUT}"
--sbom-scanner-command="trivy filesystem -q {CONTEXT} --format cyclonedx --output {OUTPUT}"
--sbom-merge-strategy=merge-cyclonedx-by-component-name-and-version
- "trivy-spdx":
--sbom-scanner-image=ghcr.io/aquasecurity/trivy
--sbom-scanner-command="trivy filesystem -q {ROOTFS} --format spdx-json --output {OUTPUT}"
--sbom-scanner-command="trivy filesystem -q {CONTEXT} --format spdx-json --output {OUTPUT}"
--sbom-merge-strategy=merge-spdx-by-package-name-and-versioninfo
**--sbom-image-output** *path*
When generating SBOMs, store the generated SBOM in the specified path in the
output image. There is no default.
**--sbom-image-purl-output** *path*
When generating SBOMs, scan them for PURL ([package
URL](https://github.com/package-url/purl-spec/blob/master/PURL-SPECIFICATION.rst))
information, and save a list of found PURLs to the named file in the local
filesystem. There is no default.
**--sbom-merge-strategy** *method*
If more than one ** --sbom-scanner-command** value is being used, use the
specified method to merge the output from later commands with output from
earlier commands. Recognized values include:
- cat
Concatenate the files.
- merge-cyclonedx-by-component-name-and-version
Merge the "component" fields of JSON documents, ignoring values from
documents when the combination of their "name" and "version" values is
already present. Documents are processed in the order in which they are
generated, which is the order in which the commands that generate them
were specified.
- merge-spdx-by-package-name-and-versioninfo
Merge the "package" fields of JSON documents, ignoring values from
documents when the combination of their "name" and "versionInfo" values is
already present. Documents are processed in the order in which they are
generated, which is the order in which the commands that generate them
were specified.
**--sbom-output** *file*
When generating SBOMs, store the generated SBOM in the named file on the local
filesystem. There is no default.
**--sbom-purl-output** *file*
When generating SBOMs, scan them for PURL ([package
URL](https://github.com/package-url/purl-spec/blob/master/PURL-SPECIFICATION.rst))
information, and save a list of found PURLs to the named file in the local
filesystem. There is no default.
**--sbom-scanner-command** *image*
Generate SBOMs by running the specified command from the scanner image. If
multiple commands are specified, they are run in the order in which they are
specified. These text substitutions are performed:
- {ROOTFS}
The root of the built image's filesystem, bind mounted.
- {CONTEXT}
The build context and additional build contexts, bind mounted.
- {OUTPUT}
The name of a temporary output file, to be read and merged with others or copied elsewhere.
**--sbom-scanner-image** *image*
Generate SBOMs using the specified scanner image.
2020-01-16 01:23:38 +08:00
**--sign-by** *fingerprint*
Sign the new image using the GPG key that matches the specified fingerprint.
2025-04-30 04:37:27 +08:00
**--source-date-epoch** *seconds*
Set the "created" timestamp for the image to this number of seconds since the
epoch (Unix time 0, i.e., 00:00:00 UTC on 1 January 1970) to make it easier to
create deterministic builds (defaults to $SOURCE_DATE_EPOCH if set, otherwise
the current time will be used).
The "created" timestamp is written into the image's configuration and manifest
when the image is committed, so committing the same working container at two
different times will produce images with different sha256 hashes, even if no
other changes were made to the working container in between.
When --source-date-epoch is set, the "created" timestamp is always set to the time
specified, which should allow for identical images to be committed at different
times.
2025-04-30 05:04:20 +08:00
Conflicts with the similar ** --timestamp** flag, which also sets its specified
time on layer contents.
2018-05-22 05:02:50 +08:00
**--squash**
Squash all of the new image's layers (including those inherited from a base image) into a single new layer.
2020-09-11 22:06:31 +08:00
**--timestamp** *seconds*
2019-01-19 01:39:49 +08:00
2025-04-30 04:37:27 +08:00
Set the "created" timestamp for the image to this number of seconds since the
epoch (Unix time 0, i.e., 00:00:00 UTC on 1 January 1970) to make it easier to
create deterministic builds (defaults to current time).
The "created" timestamp is written into the image's configuration and manifest
when the image is committed, so committing the same working container at two
different times will produce images with different sha256 hashes, even if no
other changes were made to the working container in between.
When --timestamp is set, the "created" timestamp is always set to the time
specified, which should allow for identical images to be committed at different
times. All content in the new layer added as part of the image will also bear
this timestamp.
2019-01-19 01:39:49 +08:00
2025-04-30 05:04:20 +08:00
Conflicts with the similar ** --source-date-epoch** flag, which by default does
not affect the timestamps of layer contents.
2020-12-30 20:16:24 +08:00
**--tls-verify** *bool-value*
Require HTTPS and verification of certificates when talking to container registries (defaults to true). TLS verification cannot be used when talking to an insecure registry.
2025-06-21 03:05:20 +08:00
**--unsetannotation** *annotation*
Unset the image annotation, causing the annotation not to be inherited from the base image.
2021-11-02 04:52:48 +08:00
**--unsetenv** *env*
Unset environment variables from the final image.
2017-03-29 03:37:24 +08:00
## EXAMPLE
2017-04-14 03:42:04 +08:00
2017-08-25 05:44:32 +08:00
This example saves an image based on the container.
2018-04-11 01:07:31 +08:00
`buildah commit containerID newImageName`
2017-08-25 05:44:32 +08:00
2024-01-08 22:58:08 +08:00
This example saves an image named newImageName based on the container and removes the working container.
2017-08-25 05:44:32 +08:00
`buildah commit --rm containerID newImageName`
2024-01-08 22:58:08 +08:00
This example commits to an OCI archive file named /tmp/newImageName based on the container.
`buildah commit containerID oci-archive:/tmp/newImageName`
2023-12-17 20:00:58 +08:00
2020-07-29 22:45:17 +08:00
This example saves an image with no name, removes the working container, and creates a new container using the image's ID.
`buildah from $(buildah commit --rm containerID)`
2017-08-25 05:44:32 +08:00
This example saves an image based on the container disabling compression.
`buildah commit --disable-compression containerID`
2017-04-14 03:42:04 +08:00
2017-08-25 05:44:32 +08:00
This example saves an image named newImageName based on the container disabling compression.
`buildah commit --disable-compression containerID newImageName`
2017-04-14 03:42:04 +08:00
2017-08-25 05:44:32 +08:00
This example commits the container to the image on the local registry while turning off tls verification.
`buildah commit --tls-verify=false containerID docker://localhost:5000/imageId`
2017-04-14 03:42:04 +08:00
2017-08-25 05:44:32 +08:00
This example commits the container to the image on the local registry using credentials and certificates for authentication.
`buildah commit --cert-dir ~/auth --tls-verify=true --creds=username:password containerID docker://localhost:5000/imageId`
2017-03-29 03:37:24 +08:00
2018-01-31 08:19:30 +08:00
This example commits the container to the image on the local registry using credentials from the /tmp/auths/myauths.json file and certificates for authentication.
2018-05-02 03:37:13 +08:00
`buildah commit --authfile /tmp/auths/myauths.json --cert-dir ~/auth --tls-verify=true --creds=username:password containerID docker://localhost:5000/imageName`
2018-01-31 08:19:30 +08:00
2020-08-27 04:56:57 +08:00
This example saves an image based on the container, but stores dates based on epoch time.
`buildah commit --timestamp=0 containerID newImageName`
2021-08-11 06:11:15 +08:00
### Building an multi-architecture image using the --manifest option (requires emulation software)
2020-12-30 20:16:24 +08:00
```
#!/bin/sh
build() {
ctr=$(./bin/buildah from --arch $1 ubi8)
./bin/buildah run $ctr dnf install -y iputils
./bin/buildah commit --manifest ubi8ping $ctr
}
build arm
build amd64
build s390x
```
2019-08-13 12:23:28 +08:00
## ENVIRONMENT
**BUILD\_REGISTRY\_SOURCES**
BUILD\_REGISTRY\_SOURCES, if set, is treated as a JSON object which contains
lists of registry names under the keys `insecureRegistries` ,
`blockedRegistries` , and `allowedRegistries` .
When committing an image, if the image is to be given a name, the portion of
the name that corresponds to a registry is compared to the items in the
`blockedRegistries` list, and if it matches any of them, the commit attempt is
denied. If there are registries in the `allowedRegistries` list, and the
portion of the name that corresponds to the registry is not in the list, the
commit attempt is denied.
2019-12-18 00:01:52 +08:00
**TMPDIR**
The TMPDIR environment variable allows the user to specify where temporary files
are stored while pulling and pushing images. Defaults to '/var/tmp'.
2019-08-13 12:23:28 +08:00
## FILES
2018-05-03 04:53:27 +08:00
**registries.conf** (`/etc/containers/registries.conf`)
2018-06-11 21:57:45 +08:00
registries.conf is the configuration file which specifies which container registries should be consulted when completing image names which do not include a registry or domain portion.
2018-05-03 04:53:27 +08:00
2019-02-27 23:29:09 +08:00
**policy.json** (`/etc/containers/policy.json`)
Signature policy file. This defines the trust policy for container images. Controls which container registries can be used for image, and whether or not the tool should trust the images.
2017-03-29 03:37:24 +08:00
## SEE ALSO
2024-01-26 04:50:33 +08:00
buildah(1), buildah-images(1), containers-policy.json(5), containers-registries.conf(5), containers-transports(5), containers-auth.json(5)