Lesson 4 Understanding and Creating Docker Image in Depth
Lesson 4 Understanding and Creating Docker Image in Depth
1. Image Understanding
1. An image is a lightweight, executable, and self-sufficient software
package, including all the necessary components for running software. The
application and configurations are packaged into a complete, deliverable, and
deployable running environment that contains code, runtime, required libraries,
environment variables, configuration files, etc, which is the image file.
2. The docker containers can only be instantiated from image files.
3. Image Layering
When an image is downloaded, please observe the downloaded log
output. You can see it is downloaded layer by layer.
1
Enter the command “docker image inspect mysql” in the terminal to check
the image layering.
4. Image Creating
When the downloaded images from the docker image repository cannot
meet your requirements, there are two ways to modify them.
omitted】
3
2) Enter “docker commit 9aeb4cc795e6 debain:1.0” in the terminal to
commit the image of container “9aeb4cc795e6” and name it “debian”. The tag
name is 1.0.
3) Enter “docker images” in the terminal to view the images on the master.
You can see a “debain” has been added to the list of images.
4
1) Press “Ctrl+Alt+T” to open the command line terminal. Enter “vim
Dockerfile” in the terminal to create and open the file.
2) Type the content shown below in the terminal and press “ESC”. Enter “:
wq” to exit and save the file.
4) Enter “docker images” in the terminal, then you can see the newly built
5
image.