Docker save/load lose original image repository/name/tag

Zizou picture Zizou · May 13, 2017 · Viewed 28.3k times · Source

I'm using Docker 1.12.6.

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

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

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?

Answer

csu007 picture csu007 · Nov 14, 2018

Use

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

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

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