I am brand new to Docker and following the Getting Started tutorial. At step 7 it says
type
docker imagescommand and press RETURN. The comma
Yes, this is very confusing terminology.
Simplest answer:
Image: a single image.
Repository: a collection of images.
Details:
Image: Uniquely referenced by the Image ID, the 12 digit hex code (e.g. 91c95931e552). [1]
Repository: Contains one or more images. So the hello-world repository could contain two different images: 91c95931e552 and 1234abcd5678.
Image alias - I'm going to define image alias to mean an alias that references a specific image. The format of an image alias is repository:tag. This way, you can use a human-friendly alias such as hello-world:latest instead of the 12-digit code.
Example:
Let's say I have these images:
REPOSITORY TAG IMAGE ID
docker/whalesay latest fb434121fc77
hello-world latest 91c95931e552
hello-world v1.1 91c95931e552
hello-world v1.0 1234abcd5678
The repositories are: docker/whalesay, hello-world.
The images are fb434121fc77, 91c95931e552, 1234abcd5678. Notice that the 2nd and 3rd rows have the same Image ID, so they are the same image.
The image aliases are:
docker/whalesay:latest
hello-world:latest
hello-world:v1.1
hello-world:v1.0
So hello-world:latest and hello-world:v1.1 are simply two aliases for the same image.
Additional Details:
Repository name format can also prepend an optional user or namespace, which is useful when using a public registry like Docker Hub. E.g. docker/whalesay. Otherwise, you will have a lot of repository name conflicts.
If you leave out the tag when referencing an image alias, it will automatically add :latest. So when you specify hello-world, it will be interpreted as hello-world:latest. Warning: latest doesn't actually mean anything special, it's just a default tag.
[1] Actually, the full Image ID is a 64 digit hex code truncated to 12 digits, but you don't need to care about that.