How to build your own Base Image image
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.