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?
Docker tags make it easy to benefit from the hard work of others by running their images directly or by creating new derived ones. Simply head over to Docker Hub, choose a tag, and each time you pull the image, you'll get the latest version pushed by the authors.
3.3. Here, in the above command, we built the image without any tag, so By default, Docker provides a tag to the image as the latest “baeldung-java:latest”. Docker always points to the latest stable release using the latest tag.
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
I had the same problem, so I used the following command to fix it manually:
docker tag <Image-ID> <desired Name:Tag>
Reference
[NOTE]:
It's inconsistent:
docker save image-repo-name
->docker load
restores name,docker save SHA
->docker load
no names or tags,docker save name:latest
->docker load
no names or tags.
AND:
The current (and correct) behavior is as follows:
docker save repo
Saves all tagged images + parents in the repo, and creates a repositories file listing the tags
docker save repo:tag
Saves tagged image + parents in repo, and creates a repositories file listing the tag
docker save imageid
Saves image + parents, does not create repositories file. The save relates to the image only, and tags are left out by design and left as an exercise for the user to populate based on their own naming convention.
Reference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With