title: GitLab CI/CD Docker-In-Docker Failing with Custom DIND Service
body: <p>I've had CI/CD set up in our private GitLab instance for a while now to build some packages, create docker images from them, and push them to our internal registry.  The configuration looks like this:</p>
  <pre><code>stages:
    - build
  
  services:
    - docker:18.09.4-dind
  
  image: localregistry/utilities/tools:1.0.5
  
  build:
    stage: build
    script:
      - mvn install
      - docker build -t localregistry/proj/image:$VERSION .
      - docker push localregistry/proj/image:$VERSION
    tags:
      - docker
  </code></pre>
  <p>This has worked quite well up until today, when we started getting hit with rate limiting errors from Docker.  We have a large company so this isn't entirely unexpected, but it prompted me to look at locally caching some of the docker images that we use frequently.  As a quick test, I pulled, retagged, and pushed to our local registry the <code>docker:18.09.4-dind</code> image and changed the line in the CI/CD configuration to:</p>
  <pre><code>services:
    - localregistry/utilities/docker:18.09.4-dind
  </code></pre>
  <p>To my surprise when running the CI/CD job, while the image appeared to start up fine I started having docker problems:</p>
  <pre><code>$ docker build -t localregistry/proj/image:$VERSION .
  Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
  </code></pre>
  <p>The next hour or so was spent examining the runner and the various docker environments that get executed there, trying to figure out what the difference could be from simply retagging the DIND image, but couldn't figure anything out; the only difference that could be found is that <code>DOCKER_HOST=tcp://docker:2375</code> was set in the environment when using <code>docker:18.09.4-dind</code>, but not when using <code>localregistry/utilities/docker:18.09.4-dind</code> - although setting it explicitly didn't help, triggering this message:</p>
  <pre><code>error during connect: Get http://docker:2375/v1.39/containers/json?all=1: dial tcp: lookup docker on 151.124.118.131:53: no such host
  </code></pre>
  <p>During that time the rate limit was lifted and I was able to switch back to the normally tagged version, but I can't see a reason why a locally tagged version wouldn't work; any ideas as to why this is?</p>