title: Docker registry mirror not used
body: <p>When I try to pull an image from my local mirror, it works :</p>
  
  <pre><code>$ docker login -u docker -p mypassword nexus3.pleiade.mycomp.fr:5000
  $ docker pull nexus3.pleiade.mycomp.fr:5000/hello-world
  Using default tag: latest
  latest: Pulling from **hello-world**
  78445dd45222: Pull complete 
  Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
  Status: Downloaded newer image for **nexus3.pleiade.mycomp.fr:5000/hello-world:latest**
  </code></pre>
  
  <p>But then, when I want to use this registry as mirror, it is just ignored, images are always pulled from web Docker hub, not from my local mirror :</p>
  
  <pre><code>$ ps -ef | grep docker
  /usr/bin/dockerd -H fd:// --storage-driver=overlay2 --registry-mirror=https://nexus3.pleiade.mycomp.fr:5000
  
  $ docker info
  Registry Mirrors:
   https://nexus3.pleiade.mycomp.fr:5000/
  
  $ docker rmi nexus3.pleiade.mycomp.fr:5000/hello-world
  </code></pre>
  
  <p>_</p>
  
  <pre><code>$ docker pull hello-world
  Using default tag: latest
  latest: Pulling from **library/hello-world**
  78445dd45222: Pull complete 
  Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
  Status: Downloaded newer image for **hello-world:latest**
  </code></pre>
  
  <p>I know for sure it doesn't use my mirror, because when I unset the proxy settings, it cannot reach hello-world image.</p>
  
  <p>Is it a Docker bug, or am I missing something ?</p>
  
  <p>Docker info (short) :</p>
  
  <pre><code>Server Version: 1.13.1
  Storage Driver: overlay2
  (...)
  Security Options:
   apparmor
   seccomp
    Profile: default
  Kernel Version: 4.8.0-37-generic
  Operating System: Ubuntu 16.10
  OSType: linux
  Architecture: x86_64
  CPUs: 2
  Total Memory: 15.67 GiB
  (...)
  Registry Mirrors:
   https://nexus3.pleiade.edf.fr:5000/
  </code></pre>
  
  <p><strong>UPDATE</strong> :</p>
  
  <p>Doing "journalctl -xe", I can see some useful information :</p>
  
  <p><code>level=error msg="Attempting next endpoint for pull after error: Get https://nexus3.pleiade.mycomp.fr:5000/v2/library/hello-world/manifests/latest: no basic auth credentials"</code></p>
  
  <p>It looks related to : <a href="https://github.com/docker/docker/issues/20097" rel="noreferrer">https://github.com/docker/docker/issues/20097</a>, but the workaround is not working : when I replace --registry-mirror=<a href="https://nexus3.pleiade.mycomp.fr:5000" rel="noreferrer">https://nexus3.pleiade.mycomp.fr:5000</a> by --registry-mirror=<a href="https://docker:password@nexus3.pleiade.mycomp.fr:5000" rel="noreferrer">https://docker:password@nexus3.pleiade.mycomp.fr:5000</a></p>
  
  <p>I get exactly the same error.</p>
  
  <p>If it matters, the nexus is using a self signed certificate which has been copied to /etc/docker/certs.d/nexus3.pleiade.mycomp.fr:5000/ca.crt and this allowed to login via "docker login".</p>