docker images 導入和導出
目錄
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