title: Docker DIND unable to access private registry
body: <p>I am using GitLab along with GitLab runner and DIND.</p>
  
  <p>Configuration details:</p>
  
  <pre><code>---------------------------------------
  
  docker run --privileged --name gitlab-dind -d --restart=always docker:17.07-dind
  
  ---------------------------------------
  
  cat gitlab_runner.sh
  docker run -d --name gitlab-runner --restart always \
    -v /mnt/data/gitlab/gitlab-runner:/etc/gitlab-runner \
    --link gitlab-dind:docker \
    gitlab/gitlab-runner:v9.5.0
  
  ---------------------------------------
  
  cat /mnt/data/gitlab/gitlab-runner/config.toml
  concurrent = 1
  check_interval = 0
  
  [[runners]]
    name = "RunnerA"
    url = "https://gitlab.dev.abc.net"
    token = "d8ed43a69ebed74ccab2493857d8cb"
    executor = "docker"
    [runners.docker]
      tls_verify = false
      image = "docker:17.07"
      privileged = false
      disable_cache = false
      volumes = ["/cache"]
      host = "tcp://gitlab-dind:2375"
      shm_size = 0
    [runners.cache]
  
  ---------------------------------------
  
  cat ~/wksp/test-proj/.gitlab-ci.yml
  image: docker.artifactory.abc.net/docker:17.07
  
  variables:
    DOCKER_HOST: tcp://docker:2375
  
  # This before_script block was added later but it seems this block
  # isn't executed before the DIND tries fetching image from Artifactory
  before_script:
    - docker login -u svc-art-user -p some-pwd docker.artifactory.abc.net
    - docker info
  
  services:
  - docker.artifactory.abc.net/docker:17.07-dind
  
  build:
    stage: build
    script:
    - docker build -t my-docker-node-image .
  
  ---------------------------------------
  </code></pre>
  
  <p>As an aside, in the above configuration, is <code>DOCKER_HOST</code> config needed in <code>.gitlab-ci.yml</code> or just the entry (<code>host = "tcp://gitlab-dind:2375</code>) in <code>config.toml</code> suffice?</p>
  
  <p>Now when the runner runs, i get the following error:</p>
  
  <pre><code>Runner log error:
  Running with gitlab-ci-multi-runner 9.5.0 (413da38)
    on RunnerA (d8ed43a6)
  Using Docker executor with image docker.artifactory.abc.net/docker:17.07 ...
  Starting service docker.artifactory.abc.net/docker:17.07-dind ...
  Pulling docker image docker.artifactory.abc.net/docker:17.07-dind ...
  ERROR: Preparation failed: Error response from daemon: Get https://docker.artifactory.abc.net/v2/: x509: certificate signed by unknown authority
  </code></pre>
  
  <p>I may be wrong but it seems this error is because the <em>service account</em> (<code>svc-art-user</code>) isn't able to login <em>before</em> the DIND image pull happens.</p>