-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow for configuring the docker hub registry endpoint via API #21385
base: main
Are you sure you want to change the base?
feat: allow for configuring the docker hub registry endpoint via API #21385
Conversation
a250a3e
to
2df26b3
Compare
/label release-note/enhancement |
Signed-off-by: Jan Larwig <[email protected]>
2df26b3
to
d33cf33
Compare
@Vad1mo any feedback on the approach? Do you want me to write an apitest? |
Makes sense to me.. It might be the stupid questions. but why is the URL hardcoded and not changeable in the first place? |
I have no idea why it is hardcoded 😅 If you want me to change the UI as well to allow changing it. I can do it as part of this PR or another. Just let me know what you guys would prefer on how to continue |
We're doing this due to the behavior in the upstream. You can refer to the following link for more details: https://github.com/moby/moby/blob/master/registry/config.go#L43. @tuunit, If you need to access Docker Hub through a proxy, you should configure the proxy for harbor-core and jobservice, rather than updating the Docker Hub URL. |
@wy65701436 thanks for actually finding the original place in the moby code base 😅 Nevertheless, I already know that is the official registry URL of docker hub. But as explained in my PR description, it is sometimes necessary to run Harbor inside an air gapped / private environment without direct internet access and therefore replications / caching might need to go through a simple reverse proxy to communicate with the public web. For this purpose it would be great to keep the logic of the |
The strategy Docker is following is for commercial reasons and backwards compatibility only. We should not limit ourselves to that. If we ask ourselves why people user Harbor. One of the big arguments for Harbor is replication.
Regarding this PR or its further thinking
Personally, I don't see any strong argument against it, or any negative consequences. |
Comprehensive Summary of your change
This PR adds the possibility to change the registry endpoint of DockerHub via API. This is useful for Harbor instances that run in airgapped environments and have to go through a DMZ or use a reverse proxy to access DockerHub.
Why not just use a normal Docker Registry type instead of the DockerHub adapter?
Because of the logic for
library
images which only applies to the Registry Type DockerHub:harbor/src/server/middleware/repoproxy/proxy.go
Lines 128 to 144 in 8bf710a
By allowing to change the registry endpoint for DockerHub, those kinds of environments can still benefit from the
library
substitution logic.Please indicate you've done the following: