Search code examples
docker-registrydockerhub

The different account types on Docker Hub registry... how it works?


I can't understand how the different "levels" or account types work in Docker Hub registry. I'll explain what I mean.

First case: lot of packages without a "prefix" labeled as Official Docker Images like php, nginx, mariadb etc. The URL for those repositories is prefixed with /_/ in the path, like hub.docker.com/_/php.

Second case: lot of packages "known", with a prefix and labeled as Sponsored OSS like pihole/pihole. The URL for those repositories is prefixed with /r/ in the path, like hub.docker.com/r/pihole/pihole.

Regular user case: on the contrary, when I push to Docker Hub, I'm forced to specify my username as prefix. So my images ends up to be: <username>/foo:latest. My page prefix is /u/ like hub.docker.com/u/<username>

What this represents on Docker Hub? Will a regular user able to push images without a prefix?


Solution

  • Short answer: NO

    You have to differentiate between how data is represented on the website & URLs for humans e.g. on Docker Hub as hub.docker.com/r/pihole/pihole and the address of the images that you can pull. e.g. on the CLI with your container runtime (Docker in this case). docker pull pihole/pihole

    The correlation you see in the URL of the UI and CLI is not chained together. For example, .../r/... didn't exist a few years back.

    Docker does quite a bit of magic to resolve image names. Allowing you to write something like:

    docker pull nginx which gets resolved by the Docker runtime to docker.io/library/nginx:latest

    Not all container runtimes behave the same, in some you have to explicitly specify a FQN like docker.io/library/nginx:latest in oder to fully address the image location.

    If you are using a different container runtime like Podman, you could, however, customize the resolution logic to your own needs so that the runtime turns:

    podman pull my_app to resolve into podman pull my.container-registry.com/library/my_app:latest