Docker layered download understanding and docker submit its own image

1. Docker layered download understanding

All docker images originate from a basic image. When the image is modified or new content is added, a new image layer will be created on top of the current image layer.

The following example:
Insert picture description here
Insert picture description here
as shown in the figure, the tomcat image has 10 layers.

2. Docker submits its own image

1. Download an official tomcat mirror

Code:

docker pull tomcat

Screenshot:
Insert picture description here

2. Start the image in the background

Code:

docker run -d --name tomcat -p 8003:8080 tomcat

Screenshot:
Insert picture description here

3. Enter the container

Code:

docker exec -it tomcat /bin/bash

Screenshot:
Insert picture description here

4. Copy webapps.dist to webapps

Code:

cp -r webapps.dist/* webapps

Screenshot:
Insert picture description here
Test:
There is nothing in the official mirror webapps, and access will report that the resource cannot be found, but after I copy the things in webapps.dist to webapps, visit it again and the default interface of tomcat will appear, as shown below
Insert picture description here

5. Submit our modified image

Code:

docker commit -a="作者" -m="描述" 容器id 目标名字:版本

Screenshot:
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_43520670/article/details/113550689