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. IDEA GIt 提交提示 “Contents are identica“

    2024-03-14 11:28:04       38 阅读
  2. Git 忽略提交 .gitignore

    2024-03-14 11:28:04       56 阅读
  3. Git提交规范详解

    2024-03-14 11:28:04       58 阅读
  4. Git 提交类型前缀

    2024-03-14 11:28:04       51 阅读
  5. Git提交规范

    2024-03-14 11:28:04       69 阅读
  6. Git 提交前缀规范

    2024-03-14 11:28:04       56 阅读
  7. git提交注释规范

    2024-03-14 11:28:04       54 阅读
  8. Git提交规范

    2024-03-14 11:28:04       58 阅读
  9. git提交代码冲突

    2024-03-14 11:28:04       50 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-14 11:28:04       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-14 11:28:04       101 阅读
  3. 在Django里面运行非项目文件

    2024-03-14 11:28:04       82 阅读
  4. Python语言-面向对象

    2024-03-14 11:28:04       91 阅读

热门阅读

  1. Docker中 仓库的使用

    2024-03-14 11:28:04       40 阅读
  2. PyQt5 使用setStyleSheet设置控件的样式

    2024-03-14 11:28:04       32 阅读
  3. 在Windows电脑上跑linux用双系统、虚拟机还是WSL?

    2024-03-14 11:28:04       41 阅读
  4. vuex怎么防止数据刷新丢失?

    2024-03-14 11:28:04       42 阅读
  5. Qt+FFmpeg+opengl从零制作视频播放器-12.界面美化

    2024-03-14 11:28:04       37 阅读
  6. 设计模式 — — 工厂模式

    2024-03-14 11:28:04       39 阅读
  7. - 概述 - 《设计模式(极简c++版)》

    2024-03-14 11:28:04       36 阅读