1、前言

前提是现在有一个可以运行的docker 环境

2、docker image 的保存

# 查看要导出的image
[root@test neutron]# docker image list
REPOSITORY                                                                TAG                 IMAGE ID            CREATED             SIZE
192.168.10.12:5000/ustackrocky/centos-binary-neutron-server               5.0.5               2c8b39ecfa44        8 days ago          1.42 GB
# 导出image
[root@test neutron]# docker save 2c8b39ecfa44 > centos-binary-neutron-server.tar
# 查看已经导出的image
[root@test neutron]# ls centos-binary-neutron-server.tar
centos-binary-neutron-server.tar

3、docker image 的导入

# 将image导入到目标环境的本地设备上
[root@test neutron]# docker load  < centos-binary-neutron-server.tar
57f0c32c575f: Loading layer [==================================================>] 202.9 MB/202.9 MB
c2d89775546b: Loading layer [==================================================>] 4.608 kB/4.608 kB
2385c99673e8: Loading layer [==================================================>] 4.608 kB/4.608 kB
Loaded image ID: sha256:2c8b39ecfa44265ec94fd4a048d5f74c4472602a5b3e4e5de942b54b71abd4cc
# 查看目标环境本地设备上的image列表
[root@test neutron]# docker image list
REPOSITORY                                                                TAG                 IMAGE ID            CREATED             SIZE
<none>                                                                    <none>              2c8b39ecfa44        8 days ago          1.42 GB

4、打上目标环境的tag

[root@test neutron]# docker tag  2c8b39ecfa44 192.168.10.200:5000/ustackrocky/centos-binary-neutron-server:5.0.5
[root@test neutron]# docker image list
REPOSITORY                                                                TAG                 IMAGE ID            CREATED             SIZE
192.168.10.200:5000/ustackrocky/centos-binary-neutron-server               5.0.5               2c8b39ecfa44        8 days ago          1.42 GB

5、将本地的image上传到目标环境的docker 仓库

[root@test neutron]# docker push  2c8b39ecfa44 192.168.10.200:5000/ustackrocky/centos-binary-neutron-server:5.0.5