转载自:https://blog.csdn.net/topswim/article/details/86613507
1.在有公网环境下使用 docker pull 命令下载相应的镜像,使用docker images 列出所有镜像:
liuchendeMacBook-Pro:Downloads liuchen$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
liucc08/tomcat8 latest b6e1a9a4ef07 3 weeks ago 626MB
liucc07/fetcher latest f76bba401ba3 3 weeks ago 117MB
mysql 8 102816b1ee7d 3 weeks ago 486MB
mysql latest 102816b1ee7d 3 weeks ago 486MB
2.使用docker save命令对镜像进行打包:
liuchendeMacBook-Pro:Downloads liuchen$ docker save -o mysql.tar mysql:latest
liuchendeMacBook-Pro:Downloads liuchen$ ls -trl mysql.tar
-rw------- 1 liuchen staff 490642944 1 23 17:03 mysql.tar
3.将打包好的镜像传送至内网环境的机器,使用docker load 命令将镜像加载:
liuchendeMacBook-Pro:Downloads liuchen$ docker load -i mysql.tar
Loaded image: mysql:latest
4.现在使用docker images 就可以查出刚才加载的镜像了。