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 > /存 ...
随机推荐
- 如何打造属于自己的Javascript武器库(封装方法)
前言 代码写的久了,就会发现很多时候都是在写一些重复的东西,这个时候就应该要考虑到提高工作效率了,比如对常用方法的封装,例如日期格式化,浏览器类型判断等. 今天这篇文章我们就来看看如何封装常用的Jav ...
- Codeforces Beta Round #25 (Div. 2 Only) A. IQ test【双标记/求给定数中唯一的奇数或偶数】
A. IQ test time limit per test 2 seconds memory limit per test 256 megabytes input standard input ou ...
- POJ 3620 Avoid The Lakes【DFS找联通块】
Avoid The Lakes Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6826 Accepted: 3637 D ...
- C++模拟链表
C++模拟链表 简易模拟链表,工厂设计模式.. 注意:请不要在操作时产生环状链表,会造成输出链表时陷入无限循环. #include <iostream> #include <stri ...
- java有自动垃圾回收机制
当垃圾收集器判断已经没有任何引用指向对象的时候,会调用对象的finalize方法来释放对象占据的内存空间~ java中垃圾回收以前听老师讲好像是内存满了他才去做一次整体垃圾回收,在回收垃圾的同时会调用 ...
- Spring bean初始化以及管理
在完成bean实例化后,spring会根据配置文件的设定情况对bean 的属性进行初始化, 1.autowire方式 (可查找自动装配对象 但bean中要有相应属性的set方法)这是一个自动装配的机制 ...
- Codeforces 908 D New Year and Arbitrary Arrangement
Discription You are given three integers k, pa and pb. You will construct a sequence with the follow ...
- PHP生成GUID的函数
GUID: 即Globally Unique Identifier(全球唯一标识符) 也称作 UUID(Universally Unique IDentifier) . GUID是一个通过特定算法产生 ...
- dxFlowChart运行时调出编辑器
dxFlowChart运行时调出编辑器 uses dxFcEdit; procedure TForm1.Button1Click(Sender: TObject);var f: TFChartEdit ...
- VUE -- stylus入门使用方法
sizes() 15px 10px sizes()[0] // => 15px stylus介绍 是个什么鬼?对于开发来说,CSS的弱点在于静态化.我们需要一个真正能提高开发效率的工具,LESS ...