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

How to build your own Docker image

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article introduces the knowledge of "how to build your own Docker image". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Command: docker container commit: Create a new image from a container's changes

The above command can be simplified as: docker commit

That is, first create a container based on a certain image, and then make some changes in the container, such as installing some software

Command: docker image build can be simplified to docker build

Re-commit the container into an image:

Docker commit (container name that has been exited) (the name of the image you want to generate)

So what's the difference between the newly generated image and the original image?

1. It is 2. 5% bigger than the original one. Their history is the same, but the new image is one more layer than the original, and this layer is some software you installed.

The way to create an image above is not very recommended, because other people will not know how the image is generated when they see this image. It is very likely that there are some unsafe things in this image.

Generally use Dockerfile to create image:

Go to Build an image via Dockerfile

Install vim on the basis of centos

Need to add FROM centos to Dockerfile

Add RUN yum install-y vim (this image is read-only, how do we write to it?)

Docker build-t (name).

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

Internet Technology

Wechat

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

12
Report