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的更多相关文章

  1. 使用docker save load 的时候的一个小问题

    当你使用docker save image_id > aa.tar ; 然后再使用 docker load < aa.tar 时, 你会发现此时导入的镜像的repository和 tag ...

  2. docker save load export import的区别

    export export命令用于持久化容器(不是镜像).所以,我们就需要通过以下方法得到容器ID: sudo docker ps -a 接着执行导出: sudo docker export < ...

  3. docker save/load以及export/import使用测试

    对于有些环境需要离线安装的情况,docker以及docker容器都需要能够支持离线安装,对于docker离线安装,比较简单,按照https://www.cnblogs.com/qq931399960/ ...

  4. docker save/load、export/import 区别

    区别: save的对象是image,产生的文件需要用load来生成image: export的对象是container,产生的文件需要用import来生成image. save Save one or ...

  5. docker~save与load的使用

    回到目录 对于没有私有仓库来说,将本地镜像放到其它服务器上执行时,我们可以使用save和load方法,前者用来把镜像保存一个tar文件,后台从一个tar文件恢复成一个镜像,这个功能对于我们开发者来说还 ...

  6. [转帖]Docker save and load镜像保存

    Docker save and load镜像保存 https://www.cnblogs.com/zhuochong/p/10064350.html docker save 和 load 以及 imp ...

  7. Docker(十三)-Docker save and load镜像保存

    持久化docker的镜像或容器的方法 Docker的镜像和容器可以有两种方式来导出 docker save #ID or #Name docker export #ID or #Name docker ...

  8. docker save docker load

    docker save && docker load docker save 镜像1 镜像2 | gzip > images.tar.gz 打包镜像为压缩文件 docker sa ...

  9. Docker save and load,镜像保存

    一.起因 docker pull 时发生错误 error pulling image configuration: Get https://dseasb33srnrn.cloudfront.net/r ...

随机推荐

  1. 原型设计模式 Prototype

    参考1 http://www.cnblogs.com/libingql/p/3633377.html http://www.cnblogs.com/promise-7/archive/2012/06/ ...

  2. JavaScript <script>标签的位置、延迟脚本(defer属性)与 异步脚本(async属性)

    一.<script>标签的位置 传统的做法是将<script>元素放在<head>元素中,例如: <!DOCTYPE html><html > ...

  3. (Review cs231n)loss function and optimization

    分类器需要在识别物体变化时候具有很好的鲁棒性(robus) 线性分类器(linear classifier)理解为模板的匹配,根据数量,表达能力不足,泛化性低:理解为将图片看做在高维度区域 线性分类器 ...

  4. CentOS7 安装 mysql8

    本文主要从以下几个方面对自己在centos7 下安装mysql8过程做如下总结: CentOS7 安装mysql8 步骤: window下的Navicat 连接MySql8: 涉及到的Linux命令 ...

  5. bzoj4358 premu

    题目链接 莫队算法 没有用线段树,而是看了showson的并查集%%% #include<algorithm> #include<iostream> #include<c ...

  6. <转>jmeter(四)HTTP请求

    本博客转载自:http://www.cnblogs.com/imyalost/category/846346.html 个人感觉不错,对jmeter讲解非常详细,担心以后找不到了,所以转发出来,留着慢 ...

  7. 通过数组和枚举简化GPIO操作编码(转)

    源: 通过数组和枚举简化GPIO操作编码

  8. Spring Boot(十八):使用Spring Boot集成FastDFS

    Spring Boot(十八):使用Spring Boot集成FastDFS 环境:Spring Boot最新版本1.5.9.jdk使用1.8.tomcat8.0 功能:使用Spring Boot将文 ...

  9. oracle merge同时包含增、删、改

    原来一直没注意,merge是可以支持delete,只不过必须的是on条件满足,也就是要求系统支持逻辑删除,而非物理删除. Using the DELETE Clause with MERGE Stat ...

  10. ERROR 1526 (HY000): Table has no partition for value xxx

    最近,我们有些功能需要使用到基于多个字段的分区,需要同时支持oracle/mysql,但是开发人员又希望尽可能少的改动业务代码,也不愿意使用多列分区,在oracle 11g之前,不支持多列分区(12. ...