Centos 7 下 docker 导入导出镜像 实践笔记

1.首先查看下本地仓库镜像

docker  images
[root@localhost ~]# docker images
REPOSITORY                                                TAG                 IMAGE ID            CREATED             SIZE
rancher/rancher                                           stable              5ebba94410d8        7 weeks ago         654MB
k8s.gcr.io/pause                                          3.1                 da86e6ba6ca1        2 years ago         742kB
registry.cn-beijing.aliyuncs.com/ilemonrain/pause-amd64   3.1                 da86e6ba6ca1        2 years ago         742kB

2.保存镜像到本地文件

docker save -o rancher.tar rancher/rancher:stable
# -o:指定保存的镜像的名字;
# rancher.tar:保存到本地的镜像名称;
# rancher/rancher:stable:镜像名字,通过"docker images"查看
#查看 导出的镜像文件rancher.tar
ll -h
[root@localhost ~]# ll -h
总用量 648M
-rw-------. 1 root root 1.3K 12月 17 10:22 anaconda-ks.cfg
-rw-------. 1 root root 648M 1月  20 14:46 rancher.tar

3.载入镜像到本地仓库

docker load --input rancher.tar 
# 或 
docker load < rancher.tar
# 导入过程中可以看到镜像已经导入 或者可以用docker images查看
docker images #查看镜像已导入
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章