DEV Community

Discussion on: How to make friends with Golang, Docker and GitLab CI

Collapse
 
jaihind213 profile image
vishnu rao

hi

its a nice post. i had a qns.

i noticed almost everywhere people use the 'image: docker:latest' in build along with dind service.

whats the purpose of using docker:17 image , cant i use alpine image with dind service and build image? , as dind launches the docker daemon ?

appreciate if you can help me understand . thanks

Collapse
 
hypnoglow profile image
Igor Zibarev

Hi Vishnu,

When building Docker images, we need both Docker client and Docker daemon. That's why we:

  • use docker:17 as a base image for the job to call Docker client;
  • add docker:dind to the job as a service for the daemon.

There is a simple example of this interaction on Docker hub hub.docker.com/_/docker without involving GitLab CI.

p.s. FYI there are alternative solutions that allow building docker images without docker client, but these are out of scope and require more effort.