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 Base Image image

2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

How to build their own Base Image image, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Mkdir hello-world creates a hello-world directory (name customization)

Vi hello.c creates a c language file "hello.c" in the hello-world directory

History | grep yum to view the history of yum

Sudo yum install gcc install gcc

Sudo yum install glibc-static install glibc-static

Gcc-static hello.c-o hello the current directory will add one more hello hello is an executable file, using the. / hello command to execute this file directly will print out hello docker

Vi Dockerfile creates a Dockerfile file in the current directory

Enter in the Dockerfile file:

FROM scratch

ADD hello /

CMD ["/ hello"]

Command: docker build-t vincent163/hello-world. Specify a Tag, plus a dot to find Dockerfile in the current directory

Then enter the command: docker image ls to see the image-> vincent163/hello-world you just created

Ls-lh to view the tiering of docker image

Docker history 30c5480f4e5d check that the hierarchical 30c5480f4e5d of docker image is the ID of image. The number of rows returned represents the number of layers.

Docker run vincent163/hello-world executes this cuntener and prints out a hello docker.

This is a Mini Program we wrote in C language. We packaged it into an image of docker, and an executable file is stored in this image.

At run time, the linux Container of the host centos is shared, and hello-world is executed on top of this Container. Although this program is very small, it can also reflect the technical architecture of docker.

Later, we may come into contact with more complex image, such as nginx,mysql, whose principle is the same as the Base image hello-world principle above.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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