In the previous article (building a Nginx server in Docker), we have described how to quickly build a practical nginx server. This time around Docker mirroring (Docker image), we'll explain how to use it. Includes three parts:
- Install Docker mirrors from Docker hub or other mirror source
- Installing Docker mirrors from image file
- Making Docker mirrors from Docker file
Find Docker Mirrors
The first step in installing Docker mirroring is to find the list of Docker mirrors you need, type:
docker search mysql
If you have permission problems, join Sudo at the front:
sudo docker search mysql
The query returns a list:
NAME DESCRIPTION stars official automated MySQL MySQL is a widely used, open-so Urce Relati ... 2981 [OK] mysql/mysql-server optimized MySQL server docker images. Crea ... 194 [OK] Centurylink/mysql Image containing MySQL. Optimized to be Li ... [OK] sameersbn/mysql [OK] jdeathe/centos-ssh-mysql CentOS-6 6.8 x86_ 64/mysql. 8 [OK] appcontainers/mysql centos/debian Based customizable mysql Con ... 8 [OK] marvambass/mysql MySQL Server based on Ubuntu 14.04 6 [OK] drupaldocker/mysql mysq L for Drupal 2 [OK] azukiapp/mysql Docker image to run MySQL by azuki-http: ... 2 [OK] yfix/mysql yfix Docker built MySQL 2 [OK] alterway/mysql Docker MySQL 2 [OK] frodenas/mysql A docker Image for MySQL 2 [OK] AndrEluiznsilva/mysql A Extension of the offical MySQL container ... 1 [OK] phpmentors/mysql MySQL server image 1 [OK] sin30/mysql MySQL images wit h my own config files. 1 [OK] tozd/mysql MySQL (mariadb fork) Docker image.
0 [OK] nanobox/mysql MySQL service for nanobox.io 0 [OK] ...
The list contains all of the MySQL mirrors, where:
- Name field is mirrored
- The Description field is a simple description of the mirror
- The number of stars reflects the popularity of the user
- Official field if it is OK, it represents that the image is officially provided and can be trusted
- The automated field is OK, which means that the mirror is based on a public script and can be trusted
- If both official and automated are not OK, you need to be extra careful when using them, which may contain malware, but can be used for personal, insensitive data.
In addition, you can search the web for the mirrors you need by visiting https://hub.docker.com/.
Download Docker Mirrors
When you find the right image, you can pass:
docker pull [REGISTRYHOST/][USERNAME/]NAME[:TAG]
To download, which is optional in square brackets:
docker pull mysql
Export Docker Mirrors
You can export a local image as a file, such as the MySQL image we just downloaded:
docker save -o mysql.tar mysql
Export our MySQL image to Mysql.tar.
Importing Docker Mirrors
Import is available with export, and the imported commands are:
docker load -i mysql.tar
Import our MySQL mirrors.
Remove Docker Mirrors
To conserve disk space, sometimes we need to remove unwanted Docker mirror files and first view the Docker mirror files We own:
docker images
Then remove the unwanted mirrors and free up disk space:
docker rmi [REGISTRYHOST/][USERNAME/]NAME[:TAG]
Compiling docker mirrors with Docker file
Make Docker file we put it in the back, let's say, if you have a document named Dockerfile, the command to compile the Docker is:
docker build -f Dockerfile .
Once successful, a Docker image file will be created under the current path.
Summary
We briefly introduced the use of Docker mirroring. Through this combat, you should have a more in-depth understanding of the Docker image.