Gitlab


Mar. 14, 2026

Docker in Docker with GitLab CI

GitLab

If you’ve worked with GitLab CI for any length of time you’ve probably needed to build a Docker image as part of a pipeline. The go-to solution is Docker-in-Docker (DinD) — running Docker inside a Docker container so your CI job can build and push images. It works, but it comes with enough quirks that it’s worth understanding what’s actually happening under the hood before you commit to it.


What is Docker-in-Docker?

Normally, a GitLab CI job runs inside a container. That container has no Docker daemon — it’s just an isolated environment for running your build steps. If you want to run docker build inside that container, you need a Docker daemon to talk to.