赞
踩
创建镜像有三种方法:
首先启动一个镜像,在容器里做修改
[root@docker ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 87a94228f133 28 hours ago 133MB
centos 7 eeb6ee3f44bd 3 weeks ago 204MB
[root@docker ~]# docker create -it --name test1 centos:7 bash
ae03a782eb8fed80190bfee1c5e459c1e82e1406a55627553e93edc943645217
[root@docker ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ae03a782eb8f centos:7 "bash" 2 seconds ago Created test1
将修改后的容器提交为新的镜像,需要使用该容器的 ID 号创建新镜像
[root@docker ~]# docker commit -m "new" -a "centos" test1 centos:test1
##commit 常用选项:
-m:说明信息
-a:作者信息
-p:生成过程中停止容器的运行
sha256:3e6e91b628effd49a7fa8fea42205
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。