The docker:dind image is required because it actually starts up the docker daemon when it is brought up by a runner. The docker cli can exist on a host/container without having the daemon running and can be pointed to control a daemon running somewhere else. I believe you could technically use the… Answer from tmos22 on forum.gitlab.com
🌐
Docker
docker.com › docker-in-docker: containerized ci workflows | docker
Docker-in-Docker: Containerized CI Workflows | Docker
June 5, 2026 - Docker-in-Docker (DinD) is a technique to run Docker containers inside another Docker container. DinD makes it easy to create an isolated environment for each application or service under test in a CI platform.
🌐
Docker Hub
hub.docker.com › _ › docker
docker - Official Image | Docker Hub
It is useful for running Docker in Docker and for interacting with a Docker engine via the Docker CLI. For more information about using the experimental "rootless" image variants, see docker-library/docker#174⁠. Note: just like the regular dind images, --privileged is required for Docker-in-Docker to function properly (docker-library/docker#151⁠ & docker-library/docker#281⁠), which is a security issue that needs to be treated appropriately.
🌐
Medium
harsh05.medium.com › docker-in-docker-dind-a-comprehensive-guide-ca242639eb99
Docker-in-Docker (DinD): A Comprehensive Guide | by @Harsh | Medium
December 21, 2023 - Docker-in-Docker (DinD) is a powerful concept that allows running Docker containers inside other Docker containers. This practice is particularly useful for scenarios where nested containerization is required, such as in CI/CD pipelines or when ...
🌐
Medium
medium.com › @priyamsanodiya340 › docker-inside-docker-dind-a-devops-power-move-33145860b4f9
Docker Inside Docker (DinD): A DevOps Power Move | by Priyam Sanodiya | Medium
February 20, 2025 - In modern DevOps workflows, running Docker inside a Docker container — commonly known as Docker Inside Docker (DinD) — has become a powerful approach, especially when setting up CI/CD pipelines.
🌐
GitLab
forum.gitlab.com › gitlab ci/cd
Why `services: docker:dind` is needed while already having `image: docker`? - GitLab CI/CD - GitLab Forum
October 3, 2020 - Hello everybody, If I want to use the docker commands in a job (for example for building an image or pushing to a registry), I understood that within the image: part of the job I have to have an image in which the docker command is available… So let’s simply have: build_job: image: docker:latest But then, why I need to have for that job also the following service config? build_job: image: docker:latest services: - docker:dind I was thinking that since the job will be ran inside th...
🌐
GitHub
github.com › jpetazzo › dind
GitHub - jpetazzo/dind: Docker in Docker · GitHub
May 23, 2019 - You can then connect to this Docker instance by starting another Docker container linking to the first one (which is a pretty amazing thing to do). For more details about the docker:dind official image, explanations about how to use it, customize it to use specific storage drivers, and other ...
Author: jpetazzo
🌐
Packagecloud
blog.packagecloud.io › 3-methods-to-run-docker-in-docker-containers
3 Methods to Run Docker in Docker Containers | Packagecloud Blog
Docker In Docker (also known as dind) allows developers to run a Docker container within an already running Docker container to support CI/CD pipelines and create sandboxed container environments.
Find elsewhere
🌐
Medium
medium.com › @gopesh3652 › running-docker-in-docker-dind-a-comprehensive-guide-1fe2e328020
Running Docker in Docker (DinD): A Comprehensive Guide | by Gopeshkhandelwal | Medium
September 8, 2023 - This command will display information about the Docker environment running inside the DinD container. While the primary purpose of DinD is to run Docker, you can also create and manage containers within the DinD container itself.
🌐
C2 Platform
c2platform.org › docs › howto › c2 › dind › dind
What is Docker-in-docker ( DinD )? | C2 Platform
March 10, 2026 - Docker-in-Docker (DinD) is a common technique used in GitLab CI/CD pipelines on Kubernetes to run Docker commands within Docker containers.
🌐
Caktusgroup
caktusgroup.com › blog › 2020 › 02 › 25 › docker-image
How to Use the "docker" Docker Image to Run Your Own Docker daemon | Caktus Group
That is to say, when you run docker on the command line, you're using the Docker client, which connects to a Docker daemon (usually running on localhost port 2376 or 2375, depending on whether TLS is or is not enabled, respectively).
🌐
Medium
adil.medium.com › the-magic-behind-docker-in-docker-dind-3cdb97dacc55
The Magic Behind Docker-in-Docker (DinD) | by adil | Medium
January 4, 2026 - Docker-in-Docker (DinD) is a popular technique in CI/CD pipelines to enable containerized builds.
Top answer
1 of 2
118

what is the difference between the docker:dind and the docker:latest images?

  • docker:latest contains everything necessary to connect to a docker daemon, i.e., to run docker build, docker run and such. It also contains the docker daemon but it's not started as its entrypoint.
  • docker:dind builds on docker:latest and starts a docker daemon as its entrypoint.

So, their content is almost the same but through their entrypoints one is configured to connect to tcp://docker:2375 as a client while the other is meant to be used for a daemon.

why are both the service and the docker image needed […]?

You don't need both. You can just use either of the two, start dockerd as a first step, and then run your docker build and docker run commands as usual like I did here; apparently this was the original approach in gitlab at some point. But I find it cleaner to just write services: docker:dind instead of having a before_script to setup dockerd. Also you don't have to figure out how to start & install dockerd properly in your base image (if you are not using docker:latest.)

Declaring the service in your .gitlab-ci.yml also lets you swap out the docker-in-docker easily if you know that your runner is mounting its /var/run/docker.sock into your image. You can set the protected variable DOCKER_HOST to unix:///var/run/docker.sock to get faster builds. Others who don't have access to such a runner can still fork your repository and fallback to the dind service without modifying your .gitlab-ci.yml.

2 of 2
-6

The container will contain only things defined in a docker image. You know you can install anything, starting from a base image. But you can also install Docker (deamon and client) in a container, that is to say a Docker IN Docker (dind). So the container will be able to run other containers. That's why gitlab need this.

🌐
Medium
medium.com › @abhi.in › how-to-install-docker-in-docker-dind-step-by-step-guide-9420066a902d
How to install docker in docker (Dind): step by step guide | by Abhishek Dubey | Medium
July 23, 2023 - Docker-in-Docker (DinD) is a powerful technique that allows running a Docker daemon inside a Docker container. While it can be immensely beneficial in certain scenarios, it is essential to use it judiciously and be mindful of the security and ...
🌐
YouTube
youtube.com › nextlvlprogramming
What Is Docker DIND? - Next LVL Programming - YouTube
What Is Docker DIND? In this informative video, we’ll take a closer look at Docker-in-Docker (DinD) and how it plays a vital role in modern software developm...
Published: February 2, 2025
Views: 4
🌐
Drone
docs.drone.io › pipeline › docker › examples › services › docker_dind
Docker (dind) | Drone
This guide covers configuring continuous integration pipelines for projects that have a Docker dependency.
🌐
Buildkite
buildkite.com › pipelines › agent › self-hosted agents › run on kubernetes › build container images › docker-in-docker (dind)
Docker-in-Docker (DinD) container builds | Buildkite Documentation
The sidecar container runs the Docker daemon (docker:dind) with elevated privileges, while your main container connects to this daemon through a shared Docker socket. This setup allows your Buildkite jobs to execute standard Docker operations ...
🌐
Nestybox Blog Site
blog.nestybox.com › 2019 › 09 › 14 › dind.html
Secure Docker-in-Docker with System Containers | Nestybox Blog Site
September 14, 2019 - If you want to see how easy it ... examples. ... Checkout our Free Trial! Docker-in-Docker, also known as DinD, is just what it says: running Docker inside a Docker container....