赞
踩
Docker Commit镜像提交
#进入tomcat,这是一个正在运行的tomcat [root@iZf8zhsqf64x47n1tpdy6oZ ~]# docker exec -it a9e823629663 /bin/bash root@a9e823629663:/usr/local/tomcat# ls BUILDING.txt LICENSE README.md RUNNING.txt conf logs temp webapps.dist CONTRIBUTING.md NOTICE RELEASE-NOTES bin lib native-jni-lib webapps work root@a9e823629663:/usr/local/tomcat# cd webapps #发现webapps内容为空 root@a9e823629663:/usr/local/tomcat/webapps# ls root@a9e823629663:/usr/local/tomcat/webapps# cd .. #复制webapps.dist全部内容至webapps root@a9e823629663:/usr/local/tomcat# cp -r webapps.dist/* webapps #复制完成后查看是否复制成功 root@a9e823629663:/usr/local/tomcat# cd webapps root@a9e823629663:/usr/local/tomcat/webapps# ls ROOT docs examples host-manager manager #复制成功后退出 root@a9e823629663:/usr/local/tomcat/webapps# exit exit [root@iZf8zhsqf64x47n1tpdy6oZ ~]# cd / [root@iZf8zhsqf64x47n1tpdy6oZ /]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a9e823629663 tomcat "catalina.sh run" 17 minutes ago Up 17 minutes 8080/tcp elated_hypatia af3bc99f4a47 portainer/portainer "/portainer" 2 days ago Up 41 hours 8000/tcp, 9443/tcp, 0.0.0.0:9000->9000/tcp portainer #提交自己修改的容器 [root@iZf8zhsqf64x47n1tpdy6oZ /]# docker commit -a="packet" -m="add webapp.dist to webapps" a9e823629663 tomcat01:1.0 sha256:0c109a855b95432460bccd95f2c13f96fe1128f40091e7903efbda6cc08d5252 #查看已经提交的容器 [root@iZf8zhsqf64x47n1tpdy6oZ /]# docker images -a REPOSITORY TAG IMAGE ID CREATED SIZE tomcat01 1.0 0c109a855b95 4 minutes ago 684 MB docker.io/portainer/portainer latest 5f11582196a4 15 months ago 287 MB docker.io/nginx latest 605c77e624dd 2 years ago 141 MB docker.io/tomcat 9.0 b8e65a4d736d 2 years ago 680 MB docker.io/tomcat latest fb5657adc892 2 years ago 680 MB docker.io/mysql latest 3218b38490ce 2 years ago 516 MB docker.io/centos latest 5d0da3dc9764 2 years ago 231 MB docker.io/elasticsearch 7.6.2 f29a1ee41030 3 years ago 791 MB ```shell
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。