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. DNN模型训练词向量原理

    转自:https://blog.csdn.net/fendouaini/article/details/79821852 1 词向量 在NLP里,最细的粒度是词语,由词语再组成句子,段落,文章.所以处 ...

  2. SQL表分区之二

    前面说的给表做表分区,现在有个问题,比如上面我们说的是按照20w为一个分割线,那些现在我们想把这个调整下怎么办?难道要把之前的分区函数和分区方案删了,重新新建分区函数和分区方案嘛? 当然,此方式肯定是 ...

  3. JavaUtil 处理Base64的图片上传

    UploadImageBase64.java package com.lee.util; import java.io.File; import java.io.FileOutputStream; i ...

  4. SQL Server char,varchar,nchar,nvarchar区别

    SQL Server char,varchar,nchar,nvarchar区别 (1)       定义: char:    固定长度,存储ANSI字符,不足的补英文半角空格. nchar:   固 ...

  5. Python文件读写、StringIO和BytesIO

    1 IO的含义 在计算机中,IO是Input/Output的简写,也就是输入和输出. 由于程序和运行时数据是在内存中驻留,由CPU这个超快的计算核心来执行,涉及到数据交换的地方,通常是磁盘.网络等,就 ...

  6. kivy __init__() got an unexpected keyword argument '__no_builder' Kivy

    from kivy.lang.builder import Builder from kivy.app import App, runTouchApp from kivy.uix.boxlayout ...

  7. Greenplum5.16.0 安装教程

    Greenplum5.16.0 安装教程 一.环境说明 1.1官方网站 Greenplum官方安装说明:https://gpdb.docs.pivotal.io/5160/install_guide/ ...

  8. python简说(十八)导入模块

    1.import xx import 一个模块的实质就是把这个python文件从头到尾执行一遍 2.import模块的查找模块的顺序 1).从当前目录下找 2).sys.path python的安装目 ...

  9. centos-6.5安装部署LNMP环境

    安装部署前,确保安装了gcc和gcc-c++ 系统信息: [root@zww ~]# cat /etc/redhat-release CentOS release 6.5 (Final) [root@ ...

  10. ldap集成jira

    jira默认支持ldap,通过管理员登录jira 点击 User Management --> User Directories --> Add Directory. 进行ldap配置: ...