I am learning about the Docker and want to clarify the meaning of a repository.
There is a single chain of union file system layers. There are references to different (maybe not all) layers in this chain and these references are called tags. The set of tags referencing layers in a single chain in Docker context is called a repository. Is it correct?
I am specifically interested if we can have more than one chain of layers in one repository. As I understand we can not, is it so?
2
Answers
All middle and base layers are cached and stored once (per layer id/hash of build steps) even if them used in different builds (image tags) or different images with same first build steps
A repository is a bit like a namespace for registries. Authorization is handled at the repository level, and blobs and manifests must be pushed (or mounted) into a repository before they can be pulled from that repository.
Those blobs are image layers and configs, each referenced by their digest (since registries are a CAS, a content addressable store). Since the blobs are content addressable, you only store them once and they get automatically deduplicated if you attempt to push them again. And the manifest for an image lists the layers and a config by digest, which is itself represented by a digest. And a tag is a (typically mutable) pointer to a manifest digest.
The layers referenced by any two manifests in the same repository can be identical, overlapping, or completely disjoint. There’s no hierarchical requirement between two manifests to have anything in common. So the short answer to the question is yes, you can have more than one chain of layers in one repository.