Docker的导入和加载有什么区别? [英] What is the difference between import and load in Docker?
问题描述
我了解 export
(用于容器)和 save
(对于图像)之间的区别。但是在一天结束时,保存或导出生成的压缩文件应该用作图像。
那么为什么有两个命令可以从tarball中创建一个图像?
docker save
确实会产生一个压缩文件,而不是所有父层和所有标签+版本。
docker export
也会产生一个tarball,但是没有任何图层/历史记录。
码头出口< CONTAINER ID>
| docker import - some-image-name:最新的
然而,一旦这些压缩包生成,加载/导入在那里:
-
docker import
从一个 tarball创建一个图像,这是 >甚至不能图像(只是要导入为图像的文件系统)
创建一个空的文件系统映像并导入
tarball的内容
-
docker load
从tarred存储库创建潜在的多个图像(因为docker save
可以在tarball中保存多个图像)。
从文件加载tarred的存储库,标准输入流
I understand the difference between export
(for containers) and save
(for images). But at the end of the day the tarball produced by either save or export should be used as an image.
So why are there 2 commands to make an image from a tarball?
docker save
will indeed produce a tarball, but all parent layers, and all tags + versions.
docker export
does also produces a tarball, but without any layer/history.
It is often used when one wants to "flatten" an image, as illustrated in "Flatten a Docker container or image" from Thomas Uhrig:
docker export <CONTAINER ID> | docker import - some-image-name:latest
However, once those tarballs are produced, load/import are there to:
docker import
creates one images from one tarball which is not even an image (just a filesystem you want to import as an image)
Create an empty filesystem image and import the contents of the tarball
docker load
creates potentially multiple images from a tarred repository (sincedocker save
can save multiple images in a tarball).
Loads a tarred repository from a file or the standard input stream
这篇关于Docker的导入和加载有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!