Docker的保存和导出有什么区别? [英] What is the difference between save and export in Docker?

查看:136
本文介绍了Docker的保存和导出有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在玩 Docker 几天,我已经做了一些图片(这真的很有趣!)。现在我想坚持我的工作,来到 save export 命令,但我不完全明白他们

I am playing around with Docker for a couple of days and I already made some images (which was really fun!). Now I want to persist my work and came to the save and export commands, but I don't fully understand them.

save export 在Docker?

What is the difference between save and export in Docker?

推荐答案

简短的答案是:


  • 保存将获取图像:对于VM或物理服务器,这将是安装.ISO映像或磁盘。基本操作系统。

  • save will fetch an image : for a VM or a physical server, that would be the installation .ISO image or disk. The base operating system.

它将打包构建图像所需的所有链的图层和元数据。然后,您可以将此保存的图像链载入另一个Docker实例,并从这些图像中创建容器。

It will pack the layers and metadata of all the chain required to build the image. You can then load this "saved" images chain into another docker instance and create containers from these images.

export 将获取整个容器:像普通VM的快照。保存操作系统当然也是您所做的任何更改,在容器生命期间写入的任何数据文件。这一个更像是传统的备份。

export will fetch the whole container : like a snapshot of a regular VM. Saves the OS of course, but also any change you made, any data file written during the container life. This one is more like a traditional backup.

它将为您提供包含容器文件系统的平面.tar存档。

It will give you a flat .tar archive containing the filesystem of your container.

编辑:由于我的解释可能仍然导致混淆,我认为重要的是要明白,其中一个命令适用于容器,而另一个与图像一起使用。

as my explanation may still lead to confusion, I think that it is important to understand that one of these commands works with containers, while the other works with images.


  • 图片必须被视为死或不可变,从其开始的0或1000个容器不会更改单字节。这就是为什么我更早地与系统安装ISO进行比较。它可能更接近实况CD。

  • An image has to be considered as 'dead' or immutable, starting 0 or 1000 containers from it won't alter a single byte. That's why I made a comparison with a system install ISO earlier. It's maybe even closer to a live-CD.

容器引导图像,并在其上添加一个附加图层它。该层存储容器上的任何更改(创建/更改/删除的文件...)。

A container "boots" the image and adds an additional layer on top of it. This layer stores any change on the container (created/changed/removed files...).

这篇关于Docker的保存和导出有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆