uTools-Manuals/docs/docker/docker commit.html
2019-04-21 11:50:48 +08:00

25 lines
1.0 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1>Docker commit 命令</h1>
<p><strong>docker commit :</strong>从容器创建一个新的镜像。</p>
<h3>语法</h3>
<pre>docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]</pre>
<p>OPTIONS说明</p>
<ul>
<li><p><strong>-a :</strong>提交的镜像作者;</p><p></p></li>
<li><p><strong>-c :</strong>使用Dockerfile指令来创建镜像</p><p></p></li>
<li><p><strong>-m :</strong>提交时的说明文字;</p><p></p></li>
<li><p><strong>-p :</strong>在commit时将容器暂停。</p><p></p></li>
</ul>
<h3>实例</h3>
<p>将容器a404c6c174a2 保存为新的镜像,并添加提交人信息和说明信息。</p>
<pre>runoob@runoob:~$ docker commit -a "runoob.com" -m "my apache" a404c6c174a2 mymysql:v1
sha256:37af1236adef1544e8886be23010b66577647a40bc02c0885a6600b33ee28057
runoob@runoob:~$ docker images mymysql:v1
REPOSITORY TAG IMAGE ID CREATED SIZE
mymysql v1 37af1236adef 15 seconds ago 329 MB
</pre>