by ithkuil · 6y ago · 0 comments
Images are basically content addressed, it should be easy to create an ecosystem where when you first use an image you pin a copy on a private cache, instead of shuffling hundreds of GB around to each leaf node of your clusters.
This way cloud providers could still sell you a managed service that implements such a cache, but it would be used transparently instead of having to change your manifests and/or FROM stanzas.
Netflix iirc has implemented a registry that uses IPFS. But talking to the right registry still requires that the image name includes the hostname of the registry.
The docker daemon has a registry-mirrors option; you can already use that to point to https://mirror.gcr.io . But you can use it only to cache the special "docker hub" images.
This seems to be a self-inflicted problem. Docker the company possibly wanted to be in the critical path
So if you have ithkuil/project on Docker Hub and donmcronald/project on GCR, you could reference them both with those short names and Artifactory or Nexus would deal with fetching them from the correct remotes.
The main downside is that you introduce the potential for namespace collisions. A second downside is that you become dependent on having that local registry aggregating images from multiple registries. Personally I don’t like it.
There was an old proposal [1] to pass the FQDN to the registry. That would allow for an auto-magical pull through cache / mirror combo along the lines of what you're asking about.
For now I use a Nexus as a pull through cache, so `hub.example.com/library/image` is an image from Docker Hub where I want it to come through the cache. Anything that's important enough to have a local copy gets pulled/pushed into my private registry. I actually find the distinction between the cache (volatile) and the registry (non-volatile) to be useful.
If I had to take a guess as to why Docker stubbornly clung to the current system it's that it's adhesive. Once you start using an alternate registry for base images, etc. it becomes really tough to swap to another one. The big mistake there is that instead of being the go to destination for public images, everyone is wholesale switching to the registry from their preferred cloud provider.
If you compare to Debian or Ubuntu packages, same use case, they have full support for mirror. When you run a debian VM in the cloud it's automatically connecting to the AWS debian mirror to pull packages. Everyone wins.
Docker distribution was designed to keep docker the company in control, not to have mirrors. Naturally it's getting substituted by competitors because they have no other choice.
I built it to deal with GCP infrastructure (private networking and Cloud Run). When we migrated to GitLab, we used it to coordinate external dependencies between Docker->GitLab registries, using GitLab CI and their Terraform support. [Internally built images are just pushed directly during CI.]. We declare the mirror state and Terraform makes it so.
https://registry.terraform.io/modules/neomantra/mirror/docke...
Not really. You can use digests to distinguish a version of a particular repository/image, but you cannot address anything with just the digest.
/v2/<name>/blobs/<digest>
The spec is ambiguous about what to do if a blob with a matching digest is found in the registry but not in the repository namespace <name>. The layer deduplication section of the spec does state that the same blob MUST be shared between repositories. The manifest digest endpoint suffers from a similar ambiguity.In any case, all I wanted to say is that it would have been quite possible to implement docker registry as a purely content addressed store + a key/value layer that binds human readable names to it. It's almost, but not quite that.