20

I saved a file whose format is .tar by docker save ,and then I load it into another server by docker load. When it succeeded, the docker give me a tip which is showed in following word.

The image file:V2.0.0Beta1-test already exists, renaming the old one with ID sha256:46952aea8dd30da5a2645d28930381c0ed5f72acd4fac43ea8556cc360d22cf7 to empty string
Loaded image: file:V2.0.0Beta1-test

And the old image should be saved,the new one need to save.What should I do now?

2
  • You are probably looking for the docker tag command.
    – Henry
    Jan 10, 2019 at 6:23
  • Your adivice is that I change the old one's tag?But now I can't find the old image.How can I find it?Or when I docker load the image,the operation failed?@Henry
    – l zhu
    Jan 10, 2019 at 6:52

1 Answer 1

29

You can tag a docker image using docker tag, actually, it creates an image with a name that you specify in docker tag command.

Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE

Tag an image referenced by ID

To tag a local image with ID “0e5574283393” into the “fedora” repository with “version1.0”:

$ docker tag 0e5574283393 fedora/httpd:version1.0

Suppose you have an image named Beta1-test, you can tag like

docker tag Beta1-test Beta1-test_old

This will tag the Beta1-test image with new Beta1-test to Beta1-test_old.

Docker tag is just a way of referring to your image. So you can remove the Beta1-test using

docker rmi -f Beta1-test

now, as you have that image with new tag Beta1-test_old

Now you are able to build image like docker build -t Beta1-test

Beta1-test this is your new image after the build, and we tag the previous one with Beta1-test_old.

You have both new having name Beta1-test and old having name Beta1-test_old

You can view you docker images using this command.

docker images

or

docker images Beta1-test
1
  • 3
    Your answer is helpful. I do some tries and it worked.I changed the old one's tag but when I listed the images ,I found that there is two records about the old one, the different point is different tag.So I deleted one record.Then I load the new file,it worked. The new one and old one are saved ,we can distinct them by tag.Thanks a lot! @Adiii
    – l zhu
    Jan 10, 2019 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.