2

I like to have my private docker registry as default one in my local and server machine.

When pulling images (ubuntu, httpd), it should check for my registry only

Thomasleveil
  • 95,867
  • 15
  • 119
  • 113

1 Answers1

0

You could forbid on firewall connecting server to dockerhub. This way dockerd will be forced to use your registry only. But that would work only for configured mirror.

In fact, to use only a private registry instead dockerhub it's not possible out of the box. There are special modifications of dockerd that allows you to set it up - see this thread How to change the default docker registry from docker.io to my private registry?.

Miq
  • 3,931
  • 2
  • 18
  • 32
  • I dont like to mention my privateregistry name anywhere in my dockerfile like `from /ubuntu` instead i just need to mention `from ubuntu` so it should go to my privateregistry instead of docker hub. – kathiresan kandasamy Mar 12 '19 at 04:46
  • There's an option that you could pull your image from private repo to the machine, tag it without the private registry host and then build the dockerfile. But in general, even if you use commercial docker trusted registry, you need to prefix private images with the registry hostname. No prefix means public image. Try considering this as a feature, to distinguish private and public images. And if you want to cache public images in your repository, then create a mirror, that will save your traffic. Prefixing with docker repo name is to explicitly say, that this is a private image, not public. – Miq Mar 12 '19 at 06:05