Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building a new docker image with the same name as an existing ones

Tags:

docker

If I build a new docker image with the same name as existing ones, will the old ones be overwritten?

like image 977
lolski Avatar asked Oct 16 '14 10:10

lolski


People also ask

How do I create a docker image from an existing image?

You can create a new image by using docker command $docker build -f docker_filename . , It will first read the Dockerfile where the instructions are written and automatically build the image. The instruction in the Dockerfile contains the necessary commands to assemble an image.

How do I copy a docker image into a new name?

To export your image to a tar file, run the docker save command, specifying a name for the . tar file, and the docker image name. This will save the docker image locally. Now you can confirm that the image is available by running docker image list on the target system.

Can docker image and container have the same name?

If you reassign a tag that is already used, then the original image will lose the tag, but will continue to exist (it will still be accessible by its image ID, and other tags might refer to it). They have both a name and a tag. You can verify that below. docs.docker.com/v17.09/engine/reference/commandline/build/…

Can multiple docker images have the same tag?

Yes you can. As long as the images' names are different you can tag them with the same ":tag".


1 Answers

Images in Docker don't have a name, they have tags.

A tag is a reference to an image. Multiple tags may refer to the same image.

If you reassign a tag that is already used, then the original image will lose the tag, but will continue to exist (it will still be accessible by its image ID, and other tags might refer to it).

like image 75
Thomas Orozco Avatar answered Oct 05 '22 05:10

Thomas Orozco