Proxying docker hub using Sonatype Nexus using registry-mirrors
Asked Answered
K

2

6

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.

Keyway answered 20/8, 2020 at 20:59 Comment(2)
Silly question: Did you restart the daemon after changing daemon.json?Wende
yup. I see it hitting it for some initial thing but for less than a second then starts downloading from Docker Hub.Keyway
S
2

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"]
}
Stoltzfus answered 9/12, 2020 at 11:56 Comment(1)
Thing is mine is a secure registry. Still upvoting because it is valid.Keyway
C
2

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.

Charest answered 13/10, 2021 at 4:19 Comment(1)
Do this where? In Docker settings or Nexus settings.Perea

© 2022 - 2024 — McMap. All rights reserved.