LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

podman-commit

Create an image from a container's changes

TLDR

Create an image from a container
$ podman commit [container] [image:tag]
copy
Set the author
$ podman commit --author "[Jane Doe]" [container] [image:tag]
copy
Apply image instructions while committing
$ podman commit --change "CMD [/bin/bash]" --change "LABEL [blue=image]" [container] [image:tag]
copy
Commit a running container without pausing it
$ podman commit --pause=false [container] [image:tag]
copy
Print only the new image ID
$ podman commit --quiet [container] [image:tag]
copy
Squash the committed layers into one
$ podman commit --squash [container] [image:tag]
copy

SYNOPSIS

podman commit [options] container [image]podman container commit [options] container [image]

DESCRIPTION

podman commit creates an image from the changed root filesystem of a container. The container is paused while the snapshot is taken, unless --pause is set to false. When the commit finishes, Podman prints the ID of the new image.podman container commit is the same command.The image records the container's current filesystem, plus any instructions passed with --change. It does not record a Containerfile, so the result cannot be rebuilt from a recipe the way podman build can.

PARAMETERS

CONTAINER

Name or ID of the container to commit.
IMAGE
Name and optional tag for the new image. If omitted, the repository and tag are `<none>`. A name with no registry component is stored under localhost.
-a, --author AUTHOR
Set the image author.
-c, --change INSTRUCTION
Apply one image instruction: CMD, ENTRYPOINT, ENV, EXPOSE, LABEL, ONBUILD, STOPSIGNAL, USER, VOLUME, or WORKDIR. Repeat the flag for more than one instruction.
--config FILE
Merge a JSON Schema2Config blob into the image configuration as the image is committed.
-f, --format oci|docker
Manifest and metadata format. The default is oci.
--iidfile FILE
Write the new image ID to a file.
--include-volumes
Include volumes that were added to the container with --volume or --mount. Off by default.
-m, --message MESSAGE
Set the commit message. The message field is not stored when the format is oci (the default).
-p, --pause=true|false
Pause the container while the image is created. The default is true.
-q, --quiet
Hide copy progress. The new image ID is still printed.
-s, --squash
Squash the newly built layers into a single layer.

INSTALL

sudo apt install podman
copy
sudo dnf install podman
copy
sudo pacman -S podman
copy
sudo apk add podman
copy
sudo zypper install podman
copy
brew install podman
copy
nix profile install nixpkgs#podman
copy

CAVEATS

The default format is oci, and OCI images do not store the commit message set with --message. Pass --format docker when that message must be kept.Volumes added with --volume or --mount are left out unless --include-volumes is set.Pausing is on by default so other processes cannot change the root filesystem mid-commit. --pause=false leaves the container running and can capture an inconsistent snapshot if writes are in flight.

HISTORY

The podman-commit manual page was first compiled in December 2017 by Urvashi Mohnani. The command is part of Podman, the daemonless container engine.

SEE ALSO

RESOURCES

Copied to clipboard
Kai