Docker保存/加载丢失原始映像存储库/名称/标签 [英] Docker save/load lose original image repository/name/tag

查看:172
本文介绍了Docker保存/加载丢失原始映像存储库/名称/标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Docker 1.12.6。

I'm using Docker 1.12.6.

我已从Docker注册表中提取了一个映像。
我已经使用 docker save 命令将图像导出为tar文件。

I have pulled an image from the Docker registry. I have exported the images as tar files using the docker save command.

我删除了原始图像图像和容器,并使用 docker load -i myImage.tar 加载导出的图像。

I removed the original image and container and loaded the exported image using docker load -i myImage.tar.

现在,在运行 docker images 我注意到我的映像丢失了其存储库/标签信息:

Now, when running docker images I notice my image have lost its repository/tag information:

    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
<none>              <none>              5fae4d4b9e02        8 weeks ago         581.3 MB

为什么会出现这种现象以及如何保留原始图像名称?

Why does it have this behavior and how do I keep the original image name?

推荐答案

使用

docker save -o filename.tar <repo>:<tag>

命令 docker save< image id> 删除存储库和标签名称。

The command docker save <image id> removes the repository and tag names.

要解决此问题,请使用 docker save< repo>:< tag> 它将保留存储库和保存文件中的标签名称。例如:

To solve this, use docker save <repo>:<tag> it will keep the repository and tag name in the saved file. For example:

docker save -o ubutu-18.04.tar ubuntu:18.04

这篇关于Docker保存/加载丢失原始映像存储库/名称/标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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