Why `services: docker:dind` is needed while already having `image: docker`?

I would add one important fact - docker (here as the name of the image *docker*:latest) images are setting DOCKER_HOST to a remote daemon running in container resolvable under the name docker.

So the correct Docker daemon (run by dind service) is automagically picked up by the job container because GitLab CI assigns name docker to the service container based on the image name. That is IMO not that obvious on the first glance.

4 Likes