Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The command to create the docker-docker image of "docker practical article" python (32)

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Last time I said that after downloading the docker appium image to the local place, I used docker run to command the port of appium, and started the Douyin application in the Night God Simulator through python script. I never mentioned the production of docker image before, and how to customize my docker image if you want to customize it.

The method of making Mirror in docker

Image is the basis of the container. When you run the container, you will specify which image is the basis for the container to run. In the previous example, the images used are all images in dockerHub. Using these images directly can meet our needs. When these images cannot meet the needs, we need to customize the images. The mirror is layered and multi-layer storage, each layer is modified on the basis of the previous layer, the container is also multi-layer storage, the mirror is the basic layer, the storage layer of the container is formed on the basis of the image.

Commit can be used to make mirrors.

1. Download the basic image nginx

Docker run-- name webnginx-d-p 80:80 nginx

two。 View the container

Visit browser: http://192.168.70.100

3. Modify the text of the default page

After docker exec-it webnginx bash# enters the container, modify the default page echo "welcome to idig8.com study docker" > / usr/share/nginx/html/index.html

4. View modified records

View the last change

Docker diff webnginx

5.docker commit command

Docker commit [options] [[:]]

Docker commit-author "idig8"-message "Modify default page" webnginx nginx:v1docker images

6.docker Mirror History

Docker history nginx:v1

7. Generate a container using a custom image

Specify a service at port 81 and discover that the container is generated according to the image of the previously packaged container.

Docker run-- name webnginx2-d-p 81:80 nginx:v1

8. Be careful to use docker commit command to generate image

Although it can intuitively help to understand the concept of mirrored tiered storage, it is not used in the real world. Hesitate to execute the command, and many files have been changed or added. This is only the simplest operation, if you install the package, compile and build, a lot of extraneous content will be added, and if you are not careful to clean up, the image will be extremely bloated. In addition, by using docker commit, all operations on the mirror are black-box operations, and the resulting image is also known as the black-box image. Try not to use this in practical work.

Make a mirror image by dockerfile

Say it next time.

PS: the customization of the image has been completed for the first time. The command used is docker commit. The manual operation adds a new layer to the old image to form a new image. You should have a feeling about the multi-layer grouping of images.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report