Docker的导入和加载有什么区别? [英] What is the difference between import and load in Docker?

查看:154
本文介绍了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 (since docker save can save multiple images in a tarball).

Loads a tarred repository from a file or the standard input stream

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

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