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

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

问题描述

我了解 export(用于容器)和 save(用于图像)之间的区别.但归根结底,保存或导出生成的 tarball 应该用作图像.

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.

那么为什么有 2 个命令可以从 tarball 制作图像?

So why are there 2 commands to make an image from a tarball?

推荐答案

docker save 确实会生成一个 tarball,但是 包含所有父层和所有标签 + 版本.

docker save will indeed produce a tarball, but with all parent layers, and all tags + versions.

docker export 也会产生一个tarball,但没有任何层/历史.

docker export does also produce a tarball, but without any layer/history.

当人们想要展平"图像时经常使用它,如展平 Docker 容器或映像" 来自 Thomas Uhrig:

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

但是,一旦生成了这些 tarball,加载/导入就可以:

However, once those tarballs are produced, load/import are there to:

  • docker import 创建one tarball 中的一个 图像,它甚至 都不是图像(只是您想作为图像导入的文件系统)
  • docker import creates one image 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 可能会创建多个来自tarred存储库的图像(因为docker save可以在tarball中保存多个图像).
    • docker load creates potentially multiple images from a tarred repository (since docker save can save multiple images in a tarball).
    • 从文件或标准输入流加载一个 tarred 存储库

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

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

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