docker: Dockerfile makes a mirror

Introduction to Dockerfile

Dockerfile is a text file
that contains instructions one by one.
Each instruction builds a layer, based on the base image, and finally builds a new image.
For developers: it can provide a completely consistent development environment for the development team. For testers
: you can directly Take the image built during development or build a new image through the Dockerfile file and start working.
For operation and maintenance personnel: during deployment, seamless application migration can be achieved

The customization of the image is actually to customize the configuration and files added by each layer. We can write each layer of modification, installation, construction, and operation commands into a script, which is the Dockerfile.

Dockerfile is a text file that contains instructions one by one. Each instruction builds a layer, so the content of each instruction describes how the layer should be built.

dockerfile, equivalent to a document, customers can generate new containers based on dockerfile

The dockerfile is just a source code file used to make a mirror. It is an instruction in the process of building a container. Docker can read the specification of the dockerfile to automatically build a container. Based on the dockerfile to make a mirror, each command will create a mirror layer, that is, the mirror is multiple Layers are superimposed, so the more layers, the less efficient it is to create a mirror image, and the fewer layers the better. Therefore, the actions that can be completed in one command should be defined by one command as much as possible.

The working logic of docker image making

First of all, there needs to be a directory for making images. There is a file in this directory named Dockerfile (the name is optional). The rules in the Dockerfile file have a specified format. The beginning of # is a comment. Instructions and parameters, docker build reads Dockerfile in order of Dockerfi

Guess you like

Origin blog.csdn.net/m0_38127564/article/details/131054083