Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rename docker image name?

Tags:

docker

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?

like image 873
l zhu Avatar asked Jan 10 '19 06:01

l zhu


People also ask

Can we change container name in docker?

The docker rename command renames a container. For example uses of this command, refer to the examples section below.

Can we rename the container ID?

A container name is given automatically when you create a container if you are not using the "–name" option. Sometimes you want to change the name of a Docker container. This can be done using the "docker container rename" command. As you can see, changing the name of a Docker container is an easy task.

How do I name a docker container?

When a container is created using Docker, Docker provides a way to name the container using the the --name <container_name> flag. However, if no name is provided by the user while creating/running a Docker container, Docker automatically assigns the container a name.


1 Answers

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
like image 59
Adiii Avatar answered Sep 18 '22 19:09

Adiii