Remember warning in official Gitlab documentation?
"If you bind the Docker socket and you are using GitLab Runner 11.11 or later, you can no longer use
docker:19.03.12-dind as a service. Volume bindings are done to the services as well, making these incompatible."
Once you may decide to run pipelines in passthrough mode or in Docker-in-Docker. As being told in Gitlab Runner documentation since you use passthrough mode you can not use Docker-in-Docker. So, you have to decide how to organize your CI/CD... Or follow this method and have advantages of both methods.
Solution lies in proper Gitlab Runner configuration. You must mount host Docker socket to runner container with different pathname. Then define it's address in environment. So, you will have ability to run in passthrough mode and not intersect with DinD service.
environment = ["DOCKER_HOST=unix:///var/run/docker_parent.sock"]
image = "docker:stable"
volumes = ["/var/run/docker.sock:/var/run/docker_parent.sock"]
To run job with DinD define DOCKER_HOST pointing to DinD in your .gitlab-ci.yaml
- echo $CI_BUILD_TOKEN | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
- docker pull $CI_REGISTRY_IMAGE/product:$CI_COMMIT_SHORT_SHA