Docker提交镜像
commit镜像
# docker commit 提交容器成为一个新的副本
# 命令和git原理类似
# docker commit -m="提交的描述信息" -a="作者" 容器id 目标镜像名:[TAG]
实战测试
# 启动Tomcat
sudo docker run -it -p 3344:8080 tomcat
# 进入Tomcat,并修改webapps内容
ubuntu@VM-0-13-ubuntu:~$ sudo docker exec -it fce775990fcd /bin/bash
root@fce775990fcd:/usr/local/tomcat# ls
BUILDING.txt CONTRIBUTING.md LICENSE NOTICE README.md RELEASE-NOTES RUNNING.txt bin conf lib logs native-jni-lib temp webapps webapps.dist work
root@fce775990fcd:/usr/local/tomcat# cp -r webapps.dist/* webapps/
# 创建my_tomcat
ubuntu@VM-0-13-ubuntu:~$ sudo docker commit -a="lxl" -m="add webapp app" fce775990fcd my_tomact:1.0
sha256:c805882c5c4d570be828390d0d92c88ba55d748e1dbd6d7464b4e508bc717e75
如果你想要的保存当前同期的状态,就可以通过commit来提交,获得一个镜像,就好比快照