Proxying docker hub using Sonatype Nexus using registry-mirrors

Viewed 2601

Similar to Docker private registry with mirror but I am using Sonatype Nexus which is similar nexus registry mirror docker hub not work but I am also using a secure password protected repository

I have these settings in for the Docker daemon.

{
  "registry-mirrors": [
    "https://repo.myprivate.com"
  ],
  "insecure-registries": [],
  "debug": true,
  "experimental": false
}

However, when I pull an image like ubuntu and look at the network access I see it is not hitting my server but the Docker Hub server.

I am guessing it is because I don't have my authentication set up for the mirror but I don't know the setting to use.

I also want to avoid doing proxy private docker registry using nexus 3 which changes the names of the images to add the address.

To pull using the proxy I had to do docker pull repo.myprivate.com/library/alpine which I want to avoid.

It seems like it prioritizes the official repository first before going to the registry-mirrors.

Another thing I tried was to block off the IP addresses using Windows firewall, but it does not fall back to my private repo either.

2 Answers

In my case the registry was HTTP (just a dev test) so I needed to add it to the insecure registries too:

{
  "insecure-registries": ["10.0.2.2:8181"],
  "registry-mirrors": ["http://10.0.2.2:8181"]
}

I struggled for quite a few hours with this same problem.

It was all about the Security->Realms. You need to select Docker Bearer Token Realm from the left column and move it to the right column.

Related