How to block a Docker registry?

Adding this to /etc/hosts on Ubuntu worked for me:

0.0.0.0 index.docker.io auth.docker.io registry-1.docker.io dseasb33srnrn.cloudfront.net production.cloudflare.docker.com

I got the list of domains from here: https://support.sonatype.com/hc/en-us/articles/115015442847-Whitelisting-Docker-Hub-Hosts-for-Firewalls-and-HTTP-Proxy-Servers


On redhat/centos add

--block-registry docker.io

to wherever you start your docker engine from ( likely /etc/sysconfig/docker on redhat, or possibly /lib/systemd/system/docker.service )

don't forget to refresh systemd if you edited the service file ( systemctl daemon-reload ) and to restart the docker engine ( systemctl restart docker.service ) in either case

now if you do a ps auxwwf | grep docker the docker engine --block-register flag should appear in the process listing.

I came here because this does not work on debian/ubuntu, and am looking for a way to do this on debian. = / HTH