11

I am refering to this link - Docker pull.

By default, docker pull pulls images from Docker Hub (https://hub.docker.com).

enter image description here

I would like to know where this link is configured on our local machine setup. I am using Docker on Windows 10.

asg
  • 2,248
  • 3
  • 18
  • 26
  • 1
    Possible duplicate of [How to change the default docker registry from docker.io to my private registry?](https://stackoverflow.com/questions/33054369/how-to-change-the-default-docker-registry-from-docker-io-to-my-private-registry) – SiHa Dec 19 '18 at 08:29
  • The linked dupe is old, but it looks like this still hasn't been implemented: https://github.com/moby/moby/pull/34319 – SiHa Dec 19 '18 at 08:30
  • @SiHa I didn't get any reference where default registry is configured at the given SO link. Can you point me to the same? – asg Dec 19 '18 at 08:36
  • 1
    I think the point is that it *isn't* configured anywhere. The only reason that I can think that you might want the information is to be able to change it, and the dupe link pretty clearly states that you can't change it. – SiHa Dec 19 '18 at 08:43
  • "I think the point is that it isn't configured anywhere" - How it's possible? It must be getting reference from somewhere.. right? I am not looking the change the same while pulling the image.. I am more interested in it's location. – asg Dec 19 '18 at 08:46
  • Lets see what we hear from others. – asg Dec 19 '18 at 08:46

1 Answers1

16

You cannot change the default domain of a docker image. This is by design:

Your Docker installation with this "private registry defined in the config file" would be incompatible with every other Docker installation out there. Running docker pull debian needs to pull from the same place on every Docker install.

A developer using Docker on their box will use debian, centos and ubuntu official images. Your hacked up Docker install would just serve your own versions of those images (if they're present) and this will break things.

You should identify your image through the full URL:

<your-private-registry>/<repository>/<image>:<tag>

The default domain docker.io (the "docker hub") is hardcoded in docker's code. For example here:

https://github.com/docker/distribution/blob/master/reference/normalize.go

Check the function splitDockerDomain which sets docker.io as registry if it's not provided by the user.

Fabian Braun
  • 3,612
  • 1
  • 27
  • 44
  • 1
    Thanks for the information but this is what I am not looking for. I would like to know - From where does Docker picks up - https://hub.docker.com as a default registry? Where it is configured - in a JSON file, JAR file, .exe file etc.. I hope I am clear on my question. – asg Dec 19 '18 at 10:13
  • 3
    It picks it up directly from the code. Check the file I linked in the end of my answer. If you read through the code of `normalize.go` you'll find the `docker.io`-URL hardcoded there. `docker.io` points to the "technical" interface of hub.docker.com. Maybe [this](https://docs.docker.com/registry/recipes/mirror/) is of interest to you. – Fabian Braun Dec 19 '18 at 10:19
  • 5
    Now I understand why RedHat discontinued support for Docker. This way of thinking is totally incompatible with corporate environments. – ibre5041 Sep 03 '20 at 15:08