One of the most frequently encountered problems in learning Docker recently is that, when downloading Docker image, because of a well-known network failure, there are many solutions on the web, such as the use of a domestic mirroring service like the Docker Hub Mirror, But for personal reasons (lucky to have a foreign VM), I prefer not to share the downloaded image via Docker registry.
The problem is clear: Without Docker registry, the Docker image on a machine is shared with other machines, that is, the Docker image is migrated locally.
The scenario is simple: Use the Docker save and load commands, as follows
1. List all the Docker image on a machine and find the image name you want to save
sudo docker images
2. Use the Docker Save command on a machine to save the image as a tar file
sudo docker save Image_name-o File_path
Where Image_name is replaced with the image name you found in the first step to save. File_path is the exported tar file path, such as/home/tmp/image1.tar
3. Upload the exported image tar file to another machine, such as Machine B. Can be used in a variety of ways, such as the SCP, not detailed here.
4. Load the image tar file with the Docker load command on the machine that needs to use image (e.g. Machine B)
sudo docker load-i File_path
Note: In addition, you can also use Docker's export and import command to achieve similar functions, about Export/save, import/load differences, you can check the Internet, do not expand here. The basic difference is that the export is the container (no history and layer information), and save is the image (with full history and layer information, support layer rollback)