9

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?

variable
  • 8,262
  • 9
  • 95
  • 215

2 Answers2

4

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.

Kapil Khandelwal
  • 1,096
  • 12
  • 19
  • Not sure if I agree with the take of this answer (there is no ground truth however), but the last statement is kind of wrong: if we define a docker image by its digest, then yes multiple images can have the same tag. Think about Python with tag 3.6 for Intel and ARM architectures: two images, same tag. And yes, the entire topic is a huge mess. No one's fault. – sarusso Nov 22 '21 at 14:26
  • 1
    I'm having problems with terminology here. `/:` is not an "image name" per the linked docs; it is a combination of image name `/` and tag name ``. For one, the allowed characters for the image name are different from the allowed characters for the tag name. I have yet to find the proper term for an image name together with a tag name `:`. – Gerhard Apr 08 '22 at 18:29
0

Can we say that image name is a combination of repository and tag - repository:tag?

I think not.

The documentation for the docker tag command has two examples:

To tag a local image with name “httpd” ...

$ docker tag httpd fedora/httpd:version1.0

and

To tag a local image with name “httpd” and tag “test” ...

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

So at least in this doc httpd:test is treated as name:tag combination.

Ilya Serbis
  • 21,149
  • 6
  • 87
  • 74