NAME¶
Podman-Commit-基于更改的容器创建新映像
SYNOPSIS¶
podman commit [options] container [image]
podman container commit [options] container [image]
DESCRIPTION¶
podman commit 根据更改后的 container 。图像的作者可以使用 --author 选项。各种映像指令可以使用 --change 选项和提交消息可以使用 --message 选项。这个 container 并且它的进程在映像提交时不会暂停。如果这不是所需的,则 --pause 选项可以设置为 true 。提交完成后,Podman打印出新图像的ID。
如果 image
不是以注册表名称组件开始的, localhost
被添加到名称中。如果 image
如果未提供,则 REPOSITORY
和 TAG
创建的图像的值设置为 <none>
。
OPTIONS¶
--change , -c = 说明¶
对创建的映像应用以下可能的说明:
CMD
ENTRYPOINT
ENV
EXPOSE
LABEL
ONBUILD
STOPSIGNAL
USER
VOLUME
WORKDIR
可以多次设置。
--config = ConfigBlobFile¶
在提交时,将指定文件中的容器配置合并到映像的配置中。文件内容应该是在https://github.com/containers/image/blob/v5.29.0/manifest/docker_schema2.go#L67.中定义的架构2Config结构的JSON编码版本
--format , -f = oci | docker¶
设置图像清单和元数据的格式。目前支持的格式有 oci 和 码头工人 。\默认为 oci 。
--iidfile = ImageIDfile¶
将映像ID写入文件。
--include-volumes¶
在提交的映像中包括由添加到容器的任何卷 --volume 或 --mount 选项添加到 [podman create] 和 [podman run] 命令。\默认为 错误 。
--message , -m = 消息¶
为已提交的映像设置提交消息。\ IMPORTANT: The message field is not supported in oci
format.
--pause , -p¶
创建映像时暂停容器。\默认为 错误 。
--quiet , -q¶
取消输出。\默认为 错误 。
--squash , -s¶
将新构建的层压缩到单个新层中。\默认为 错误 。
EXAMPLES¶
从带有入口点和标签的容器创建图像:
$ 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
使用提交消息从容器创建映像:
$ podman commit -q --message "committing container to image"
reverent_golick image-committed
e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
使用作者从容器创建图像:
$ podman commit -q --author "firstName lastName" reverent_golick image-committed
e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
创建镜像时暂停运行容器:
$ podman commit -q --pause=true containerID image-committed
e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
使用默认镜像标签从容器创建镜像:
$ podman commit containerID
e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
从具有默认必需功能的容器创建镜像:
$ podman commit -q --change LABEL=io.containers.capabilities=setuid,setgid epic_nobel privimage
400d31a3f36dca751435e80a0e16da4859beb51ff84670ce6bdc5edb30b94066
另请参阅¶
[podman(1)] , [podman-run(1)] , [podman-create(1)]
HISTORY¶
2017年12月,最初由Urvashi Mohnaniumohnani@redhat.com汇编