According to the official gitlab documentation, one way to enable docker build within ci pipelines, is to make use of the dind service (in terms of gitlab-ci services).
However, as it is always the case with ci jobs running on docker executors, the docker:latest image is also needed.
Could someone explain:
- what is the difference between the
docker:dindand thedocker:latestimages? - (most importantly): why are both the service and the docker image needed (e.g. as indicated in this example, linked to from the github documentation) to perform e.g. a
docker buildwhithin a ci job? doesn't thedocker:latestimage (within which the job will be executed!) incorporate the docker daemon (and I think thedocker-composealso), which are the tools necessary for the commands we need (e.g.docker build,docker pushetc)?
Unless I am wrong, the question more or less becomes:
Why a docker client and a docker daemon cannot reside in the same docker (enabled) container