Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the docker image name and is the name unique?

When I run docker images I can see the repository, tag, imageid, size. But there is no image name column.

Can we say that image name is a combination of repository and tag - repository:tag? And that at any point of time there can be only 1 image with the same repository name and tag value combination?

like image 438
variable Avatar asked May 06 '20 17:05

variable


People also ask

What is the docker image name?

An image name is made up of slash-separated name components, optionally prefixed by a registry hostname. Also, within a docker repository, a docker image can have multiple tags, but multiple docker images cannot have the same tag.

Is docker container name unique?

Note: Container names must be unique. That means you can only call one container web . If you want to re-use a container name you must delete the old container (with docker container rm ) before you can create a new container with the same name. As an alternative you can use the --rm flag with the docker run command.

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/…


1 Answers

Answer to both of your questions is YES

As mentioned in the docs:

An image name is made up of slash-separated name components, optionally prefixed by a registry hostname.

Basically, this is how your docker image name looks like:

<hub-user>/<repo-name>:<tag>

Now we can have multiple repositories in our docker hub account but, as mentioned in the docs, The repository name needs to be unique in that namespace

Also, within a docker repository, a docker image can have multiple tags, but multiple docker images cannot have the same tag.

like image 58
Kapil Khandelwal Avatar answered Nov 15 '22 04:11

Kapil Khandelwal