How to mirror dockerhub with artifactory How to mirror dockerhub with artifactory docker docker

How to mirror dockerhub with artifactory


First setup an artifactory remote that points to docker hub at https://registry-1.docker.io

enter image description here

Then reconfigure all docker agents to use the registry_mirror. There are multiple ways to do this, but adding --registry-mirror to the docker start up options is most likely the easiest. See the docker documentation for more information

https://docs.docker.com/registry/recipes/mirror/

Method 1

Add --registry-mirror to the OPTIONS variable in /etc/default/docker

cat /etc/default/dockerOPTIONS=" -H unix:///var/run/docker.sock --ip-forward=true --iptables=true --ip-masq=true --registry-mirror=https://docker.artifactory.example.com -G docker"

Method 2

Edit /etc/docker/registry/config.yml

proxy:  remoteurl: https://registry-1.docker.io  username: [username]  password: [password]

Method 3

If using puppet the config looks like this

  class { '::docker':    use_upstream_package_source => false,    manage_package              => false,    registry_mirror             => 'https://docker.artifactory.example.com',  }


Steps to avoid running into Dockerhub rate limits:

  1. Sign up for a Dockerhub free account if you do not already have one. Dockerhub enables credential pulls of up to 200 per 6 hours vs 100 per 6 hours for anonymous pulls.

  2. Use Artifactory as a cache between Dockerhub by setting up a remote repo to Dockerhub and a local repo to push and pull images that are not on dockerhub.

  3. Avoid using Dockerhub for personal images. Only pull official images as necessary.

  4. Setup your docker clients to always pull through Artifactory by using the docker repo path of the virtual repo ex:

    docker.artifactory.example.com/docker-virtual/myimage:1.0.0

  5. Pull official images the same way by using the path w/ the virtual repo in it.

    docker.artifactory.example.com/docker-virtual/ubuntu:latest

  6. Monitor your Dockerhub rate limits through the use of analytics JFrog has provided integrations into Splunk, Elastic, and Prometheus to monitor your rolling 6 hour window of dockerhub pull requests and cache hit ratio.


You can also get some information in an official blog JFrog released related to this.

See detailed instructions from @john-peterson in this page.