【Teacher Zhao Qiang】 Manage Docker images

Posted May 27, 20202 min read

  1. What is a Docker image

Docker is an open source application container engine that allows developers to package their applications and dependent packages into a portable container and then publish it to any popular Linux machine. It can also be virtualized. The container is completely sandboxed Mechanism, there will not be any interface between each other. A complete Docker consists of the following parts:

  • Docker Client
  • Docker Daemon
  • Docker Image image
  • Docker Container

The image is a template, a read-only file that contains the necessary environment and code for the program to run. It uses a layered file system to add each change to the original read-only file in the form of a read-write layer. Mirroring is the cornerstone of container operation. You can get a good image from the image warehouse. The mirror warehouse can use a public warehouse( https://hub.docker.com/ ), or you can build your own private mirror warehouse.
The following figure shows the system structure of the Docker image. Among them, the bottom layer of the image must be a mirror called the boot file system(bootfs), and users will not directly deal with this layer. The upper image of bootfs is the root image that we are familiar with.

The essence of mirroring is the collection of a series of files on the disk, as shown in the following figure:

Second, use and access the official public Docker image warehouse

  • Use the search command to search the mirror in the warehouse, such as:mysql

    docker search mysql

The results are as follows:

  • Use the pull command to get the mirror, such as:mysql mirror

    docker pull mysql

  • Use the obtained MySQL image to create a container

    docker run --name my_mysql -p 3306:3306
    -e MYSQL_ROOT_PASSWORD = Welcome_1 -d mysql

  • Use docker ps to view container information

  • Download another Tomcat image

    docker search tomcat
    docker pull tomcat

  • docker images show local mirrors