Docker镜像Export导出和Import导入
在使用Docker时最头痛的无非无法获取仓库镜像,我们可以通过Export导出镜像备份,通过import导入镜像。导出镜像是通过容器进行导出,下面来看镜像对应的容器:
root@default:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
94f013c55bc2 boonyadocker/tomcat-allow-remote:latest "/bin/sh -c '/usr/..." 3 weeks ago Up 4 hours 0.0.0.0:50000->50000/tcp, 0.0.0.0:18080->8080/tcp optimistic_fermat
aaa1f51447e8 boonyadocker/jenkins:latest "/bin/sh -c '/usr/..." 4 weeks ago Up 4 hours 0.0.0.0:8080->8080/tcp musing_bohr
1、导出容器镜像
sudo docker export optimistic_fermat > tomcat-allow-remote.tar
2、导入容器镜像
cat tomcat-allow-remote.tar | sudo docker import - boonyadocker/tomcat-allow-remote
3、Export Import命令
http://www.runoob.com/docker/docker-export-command.html
http://blog.csdn.net/clj198606061111/article/details/50450793
4、测试示例
(1)以一个导出的tomcat为例:
root@ubuntu:/usr/local/docker/images-tars# ls
tomcat-allow-remote.tar
root@ubuntu:/usr/local/docker/images-tars# cat tomcat-allow-remote.tar | sudo docker import - boonyadocker/tomcat-allow-remote
ae056a538cec95e23dfdb931b7bc7f5b73b6c3f3f4d005b4ff54d392102b2559
root@ubuntu:/usr/local/docker/images-tars# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
boonyadocker/helloworld latest 7e84b0f9c8a3 5 minutes ago 6.839 kB
boonyadocker/tomcat-allow-remote latest ae056a538cec 6 minutes ago 558.8 MB
hello-world latest 7a5a2d73abce 6 months ago 1.84 kB
root@ubuntu:/usr/local/docker/images-tars#
(2)以一个helloworld的打印为例:
root@ubuntu:/home/boonya# ls
hello.tar logs rmq_srv_gc.log zookeeper.out
root@ubuntu:/home/boonya# docker import - hello.tar
^Z
[2]+ Stopped docker import - hello.tar
root@ubuntu:/home/boonya# cat hello.tar | sudo docker import - boonyadocker/helloworld:latest
e12f05d657006477cb449ee7a99e97ede21b86e2eae80291bdf1b9ce7998f457
root@ubuntu:/home/boonya# sudo docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
boonyadocker/helloworld latest e12f05d65700 16 seconds ago 1.852 kB
hello-world latest 7a5a2d73abce 6 months ago 1.84 kB
consol/tomcat-7.0 latest 1439b1fbf911 2.179119 years ago 601.3 MB
root@ubuntu:/home/boonya#
镜像快速导出导入:
#查看镜像
docker images
# 镜像导出
docker save -o your_image_file.tar [image_id]
#镜像导入
docker load < your_image_file.tar
Docker镜像Export导出和Import导入的更多相关文章
- Docker镜像的导出和载入
https://www.cnblogs.com/lishidefengchen/p/10564765.html
- Docker镜像的备份和恢复
备份: docker save -o [tar包真实路径] [镜像名 ] 如:docker save -o /usr/docker_data/mongo-backup.tar mongo 导出: ...
- 简单谈谈Docker镜像的使用方法_docker
在上篇文章(在Docker中搭建Nginx服务器)中,我们已经介绍了如何快速地搭建一个实用的Nginx服务器.这次我们将围绕Docker镜像(Docker Image),介绍其使用方法.包括三部分: ...
- 【docker linux】linux系统镜像转化为docker镜像
概述 使用docker安装linux的同学都知道,你在docker提供的仓库安装linux系统,你就会体验到最精简的.最纯净的linux系统,当然,他会精简到你连ifconfig命令都需要自己配置,恰 ...
- docker镜像和容器的导出导入
本文介绍docker镜像和容器的导入导出,用于迁移.备份.升级等场景.主要用到export.import.save.load四个方法. 原文地址:代码汇个人博客 http://www.codehui. ...
- docker镜像的导入和导出
启动命令 docker run -d -p 3000:80 twang2218/gitlab-ce-zh:9.0.3 docker run -d -p 8080:80 gitlab/gitlab-ce ...
- docker镜像、docker容器导入导出命令
一.docker镜像导入导出命令 导出命令: docker save -o <保存路径> <镜像名称:标签> docker save -o ./test.tar test:la ...
- Docker 镜像-管理-导入-导出
目录 Docker 镜像基本概念 Docker 镜像加速 Docker 镜像 常用命令 Docker 镜像的创建和导出导入 Docker 镜像基本概念 我们使用的容器都是基于镜像的,镜像是由多层组成的 ...
- docker 镜像导入load、导出save以及重命名
docker 导入导出操作 save 保存(导出)镜像 # 把镜像打包成 .tar # -o 要保存路径.tar # > 要保存路径.tar # docker save 镜像id > /存 ...
随机推荐
- python的优化机制与垃圾回收与gc模块
python属于动态语言,我们可以随意的创建和销毁变量,如果频繁的创建和销毁则会浪费cpu,那么python内部是如何优化的呢? python和其他很多高级语言一样,都自带垃圾回收机制,不用我们去维护 ...
- MY97 日期控件只输入今天之前的值
<script type="text/javascript"> function GetDate() { ...
- [loj#101] 最大流 网络流模板
#101. 最大流 内存限制:512 MiB时间限制:5000 ms标准输入输出 题目类型:传统评测方式:文本比较 上传者: 匿名 提交提交记录统计讨论测试数据 题目描述 这是一道模板题. 给定 ...
- [BZOJ1070][SCOI2007]修车 费用流
1070: [SCOI2007]修车 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 6209 Solved: 2641[Submit][Status] ...
- HDU 4251 The Famous ICPC Team Again(划分树)
The Famous ICPC Team Again Time Limit: 30000/15000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- [BZOJ5288][HNOI2018]游戏(拓扑排序)
传送门:https://www.luogu.org/problemnew/show/P4436 20分的暴力加一个Random_shuffle就A了.我还能说什么.. 不过这个也不是毫无道理,复杂度应 ...
- 初步接触LVS
今天整理下思绪,定下要掌握LVS原理和使用方法.于是,看了部分关于LVS的概述和文章. 章博士在2002年写的LVS的几篇文章,在我看来,今天都值得一看.http://www.linuxvirtual ...
- Android开发之如何保证Service不被杀掉(broadcast+system/app
Android开发之如何保证Service不被杀掉(broadcast+system/app) 序言 最近项目要实现这样一个效果:运行后,要有一个service始终保持在后台运行,不管用户作出什么操作 ...
- What is a fully qualified domain name (FQDN)?
fully qualified domain name (FQDN) is the complete domain name for a specific computer, or host, on ...
- LRC的效验码的计算方法
图一中需要检验ASCI码数据是30.31.30.30.30.30.30.30,转化为16进制累加后是0000 0001,取反加1得到1111 1111,转换为ASCI码46.46.和图中是一样的. 图 ...