语法:docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
示例:docker commit -a "lgz" -m "create my tomcat" 68507832514f lgz/tomcat:1.0
OPTIONS | 说明 |
---|---|
-a | 提交的镜像作者 |
-c | 使用Dockerfile指令来创建镜像 |
-m | 提交时的说明文字 |
-p | 在commit时,将容器暂停(默认为true) |
[root@192 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
68507832514f tomcat:jdk8-openjdk "catalina.sh run" 8 minutes ago Up 8 minutes 0.0.0.0:8080->8080/tcp cranky_hellman
[root@192 ~]# docker commit -a "lgz" -m "create my tomcat" 68507832514f lgz/tomcat:1.0
sha256:894219f233ea060b1469745f226b6ed49d2bc5db64d2c4caea9e85685a85b7e7
[root@192 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
lgz/tomcat 1.0 894219f233ea 4 seconds ago 507MB
tomcat jdk8-openjdk c81106060722 13 hours ago 507MB