Docker save & load
docker save
Estimated reading time: 1 minute
Description
Save one or more images to a tar archive (streamed to STDOUT by default)
Usage
docker save [OPTIONS] IMAGE [IMAGE...]
Options
Name, shorthand | Default | Description |
--output , -o |
Write to a file, instead of STDOUT |
Parent command
Command | Description |
---|---|
docker | The base command for the Docker CLI. |
Extended description
Produces a tarred repository to the standard output stream. Contains all parent layers, and all tags + versions, or specified repo:tag
, for each argument provided.
Examples
Create a backup that can then be used with docker load
.
$ docker save busybox > busybox.tar $ ls -sh busybox.tar 2.7M busybox.tar $ docker save --output busybox.tar busybox $ ls -sh busybox.tar 2.7M busybox.tar $ docker save -o fedora-all.tar fedora $ docker save -o fedora-latest.tar fedora:latest
Cherry-pick particular tags
You can even cherry-pick particular tags of an image repository.
$ docker save -o ubuntu.tar ubuntu:lucid ubuntu:saucy
docker load
Estimated reading time: 1 minute
Description
Load an image from a tar archive or STDIN
Usage
docker load [OPTIONS]
Options
Name, shorthand | Default | Description |
--input , -i |
Read from tar archive file, instead of STDIN | |
--quiet , -q |
Suppress the load output |
Parent command
Command | Description |
---|---|
docker | The base command for the Docker CLI. |
Extended description
Load an image or repository from a tar archive (even if compressed with gzip, bzip2, or xz) from a file or STDIN. It restores both images and tags.
Examples
$ docker docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE $ docker load < busybox.tar.gz Loaded image: busybox:latest
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest 769b9341d937 7 weeks ago 2.489 MB $ docker load --input fedora.tar Loaded image: fedora:rawhide Loaded image: fedora:20 $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest 769b9341d937 7 weeks ago 2.489 MB
fedora rawhide 0d20aec6529d 7 weeks ago 387 MB
fedora 20 58394af37342 7 weeks ago 385.5 MB
fedora heisenbug 58394af37342 7 weeks ago 385.5 MB
fedora latest 58394af37342 7 weeks ago 385.5 MB
You will need to save the docker image as a tar file:
docker save -o <save image to path> <image name>
Then copy your image to a new system with regular file transfer tools such as cp
or scp
. After that you will have to load the image into docker:
docker load -i <path to image tar file>
PS: You may need to sudo
all commands.
docker save -o testxp.tar 347084c24033 #save imge:347084c24033 to file: testxp.tar docker load -i testxp.tar #load file:testxp.tar to get image docker run 347084c24033 #run image to get container docker rm -f b8b3e1503e6f #remove container:b8b3e1503e6f docker rmi 347084c24033 #remove image:347084c24033
docker run -d -e NLOGDIR=/var/log/ -e WWNamespace=dev -e ZKServerAddress=********* -p 5005:80 98006abba2695082cb9aa325ff2858285d8b6df09af517028405aed88c5410ff69d6f3e984fc
Docker save & load的更多相关文章
- 使用docker save load 的时候的一个小问题
当你使用docker save image_id > aa.tar ; 然后再使用 docker load < aa.tar 时, 你会发现此时导入的镜像的repository和 tag ...
- docker save load export import的区别
export export命令用于持久化容器(不是镜像).所以,我们就需要通过以下方法得到容器ID: sudo docker ps -a 接着执行导出: sudo docker export < ...
- docker save/load以及export/import使用测试
对于有些环境需要离线安装的情况,docker以及docker容器都需要能够支持离线安装,对于docker离线安装,比较简单,按照https://www.cnblogs.com/qq931399960/ ...
- docker save/load、export/import 区别
区别: save的对象是image,产生的文件需要用load来生成image: export的对象是container,产生的文件需要用import来生成image. save Save one or ...
- docker~save与load的使用
回到目录 对于没有私有仓库来说,将本地镜像放到其它服务器上执行时,我们可以使用save和load方法,前者用来把镜像保存一个tar文件,后台从一个tar文件恢复成一个镜像,这个功能对于我们开发者来说还 ...
- [转帖]Docker save and load镜像保存
Docker save and load镜像保存 https://www.cnblogs.com/zhuochong/p/10064350.html docker save 和 load 以及 imp ...
- Docker(十三)-Docker save and load镜像保存
持久化docker的镜像或容器的方法 Docker的镜像和容器可以有两种方式来导出 docker save #ID or #Name docker export #ID or #Name docker ...
- docker save docker load
docker save && docker load docker save 镜像1 镜像2 | gzip > images.tar.gz 打包镜像为压缩文件 docker sa ...
- Docker save and load,镜像保存
一.起因 docker pull 时发生错误 error pulling image configuration: Get https://dseasb33srnrn.cloudfront.net/r ...
随机推荐
- Qt && 常量中有换行符 && 中文
[1]VS + QT开发环境,中文内容编译时提示错误error C2001:常量中有换行符 解决方案:VC的编译器,把代码格式改为带BOM的UTF8就好了 建议步骤: (1)用Notepad++打开c ...
- python中从键盘输入内容的方法raw_input()和input()的区别
raw_input()输出结果都是字符串 Input()输入什么内容,输出就是什么内容
- Java基础整理
一.Java中的遍历 1.在java开发中会碰到遍历List删除其中多个元素的情况,如果使用一般的for循环以及增强的for循环,代码会抛出异常ConcurrentModificationExcept ...
- 创建一个简单的WCF程序
1.创建WCF服务库 打开VS2010,选择文件→新建→项目菜单项,在打开的新建项目对话框中,依次选择Visual C#→WCF→WCF服务库,然后输入项目名称(Name),存放位置(Location ...
- golang学习笔记14 golang substring 截取字符串
golang学习笔记14 golang substring 截取字符串golang 没有java那样的substring函数,但支持直接根据 index 截取字符串mystr := "hel ...
- RTMP HLS HTTP 直播协议一次看个够
直播从2016年一路火到了2017年,如今要在自己的App里加入直播功能,只要找一个现成的SDK就行了,什么拍摄.美颜.推流,一条龙服务.不过作为直播身后最重要的部分:推流协议,很多人并不是很清楚.如 ...
- 在centos上搭建JavaWeb环境(jdk+mysql+tomcat)
1.安装OpenJDK yum list java* -openjdk* -y java -version 2.安装Tomcat cd /usr/local wget https://mc.qclou ...
- 初学delphi
今天女朋友的一门课,要求用delphi 软件编程,内容是一个计算器.当然,这个工作肯定是落在我的头上了. 这个软件是我第一次使用,边自学边进行代码编写,在n多次修改完善之后,终于成形.功能不是很多,跟 ...
- zabbix 监控Nginx和PHP
原理 Nginx和PHP(5.3及以上版本)都自带了一个状态页,默认没有开启,通过开启这个状态页即可获取实时的工作状态. Nginx状态获取 Nginx的配置默认是拒绝通过IP来访问,我们可以再默认虚 ...
- django变量使用-在模板中使用视图函数中的变量
DTL语言,即django template language 第一次使用时,需要修改项目的setting.py文件,将其中TEMPLATES中的DIRS修改为os.path.join(BASE_DI ...