当前位置:   article > 正文

Docker Commit提交

Docker Commit提交

Docker Commit提交

Docker Commit镜像提交

  • 以一个正在运行的tomcat为例
  • 因为docker拉取的镜像都是删减版,所以需要将webapp.dist的文件内容复制到webapps中
  • 再将自己制作的镜像放在正在运行服务器上,不是云端服务器上
#进入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


  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/258318
推荐阅读
相关标签
  

闽ICP备14008679号