podman-build/docs/build/man/podman-commit.1
2025-10-11 12:30:35 +09:00

154 lines
4.7 KiB
Groff

.nh
.TH podman-commit 1
.SH NAME
podman-commit \- Create new image based on the changed container
.SH SYNOPSIS
\fBpodman commit\fP [\fIoptions\fP] \fIcontainer\fP [\fIimage\fP]
.PP
\fBpodman container commit\fP [\fIoptions\fP] \fIcontainer\fP [\fIimage\fP]
.SH DESCRIPTION
\fBpodman commit\fP creates an image based on a changed \fIcontainer\fP\&. The author of the image can be set using the \fB--author\fP OPTION. Various image instructions can be configured with the \fB--change\fP OPTION and a commit message can be set using the \fB--message\fP OPTION. The \fIcontainer\fP and its processes aren't paused while the image is committed. If this is not desired, the \fB--pause\fP OPTION can be set to \fItrue\fP\&. When the commit is complete, Podman prints out the ID of the new image.
.PP
If \fBimage\fR does not begin with a registry name component, \fBlocalhost\fR is added to the name.
If \fBimage\fR is not provided, the values for the \fBREPOSITORY\fR and \fBTAG\fR values of the created image is set to \fB<none>\fR\&.
.SH OPTIONS
.SS \fB--author\fP, \fB-a\fP=\fIauthor\fP
Set the author for the committed image.
.SS \fB--change\fP, \fB-c\fP=\fIinstruction\fP
Apply the following possible instructions to the created image:
.IP \(bu 2
\fICMD\fP
.IP \(bu 2
\fIENTRYPOINT\fP
.IP \(bu 2
\fIENV\fP
.IP \(bu 2
\fIEXPOSE\fP
.IP \(bu 2
\fILABEL\fP
.IP \(bu 2
\fIONBUILD\fP
.IP \(bu 2
\fISTOPSIGNAL\fP
.IP \(bu 2
\fIUSER\fP
.IP \(bu 2
\fIVOLUME\fP
.IP \(bu 2
\fIWORKDIR\fP
.PP
Can be set multiple times.
.SS \fB--config\fP=\fIConfigBlobFile\fP
Merge the container configuration from the specified file into the configuration for the image
as it is being committed. The file contents should be a JSON-encoded version of
a Schema2Config structure, which is defined at
https://github.com/containers/image/blob/v5.29.0/manifest/docker_schema2.go#L67.
.SS \fB--format\fP, \fB-f\fP=\fBoci\fP | \fIdocker\fP
Set the format of the image manifest and metadata. The currently supported formats are \fBoci\fP and \fIdocker\fP\&.
.br
The default is \fBoci\fP\&.
.SS \fB--iidfile\fP=\fIImageIDfile\fP
Write the image ID to the file.
.SS \fB--include-volumes\fP
Include in the committed image any volumes added to the container by the \fB--volume\fP or \fB--mount\fP OPTIONS to the \fBpodman create\fP and \fBpodman run\fP commands.
.br
The default is \fBfalse\fP\&.
.SS \fB--message\fP, \fB-m\fP=\fImessage\fP
Set commit message for committed image.
.br
\fIIMPORTANT: The message field is not supported in \fBoci\fR format.\fP
.SS \fB--pause\fP, \fB-p\fP
Pause the container when creating an image.
.br
The default is \fBfalse\fP\&.
.SS \fB--quiet\fP, \fB-q\fP
Suppresses output.
.br
The default is \fBfalse\fP\&.
.SS \fB--squash\fP, \fB-s\fP
Squash newly built layers into a single new layer.
.br
The default is \fBfalse\fP\&.
.SH EXAMPLES
Create image from container with entrypoint and label:
.EX
$ podman commit --change CMD=/bin/bash --change ENTRYPOINT=/bin/sh --change "LABEL blue=image" reverent_golick image-committed
Getting image source signatures
Copying blob sha256:b41deda5a2feb1f03a5c1bb38c598cbc12c9ccd675f438edc6acd815f7585b86
25.80 MB / 25.80 MB [======================================================] 0s
Copying config sha256:c16a6d30f3782288ec4e7521c754acc29d37155629cb39149756f486dae2d4cd
448 B / 448 B [============================================================] 0s
Writing manifest to image destination
Storing signatures
e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
.EE
.PP
Create image from container with commit message:
.EX
$ podman commit -q --message "committing container to image"
reverent_golick image-committed
e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
.EE
.PP
Create image from container with author:
.EX
$ podman commit -q --author "firstName lastName" reverent_golick image-committed
e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
.EE
.PP
Pause running container while creating image:
.EX
$ podman commit -q --pause=true containerID image-committed
e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
.EE
.PP
Create image from container with default image tag:
.EX
$ podman commit containerID
e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
.EE
.PP
Create image from container with default required capabilities:
.EX
$ podman commit -q --change LABEL=io.containers.capabilities=setuid,setgid epic_nobel privimage
400d31a3f36dca751435e80a0e16da4859beb51ff84670ce6bdc5edb30b94066
.EE
.SH SEE ALSO
\fBpodman(1)\fP, \fBpodman-run(1)\fP, \fBpodman-create(1)\fP
.SS Troubleshooting
See podman-troubleshooting(7)
for solutions to common issues.
.SH HISTORY
December 2017, Originally compiled by Urvashi Mohnani umohnani@redhat.com
\[la]mailto:umohnani@redhat.com\[ra]