Hi, I’m new to GitLab CI and I am trying out certain things related to running builds and tests in docker images. Today I stumbled on this configuration here https://www.testcontainers.org/ci/ci.html#gitlab
services: - docker:dind test: image: docker:latest stage: test script: - > docker run -t --rm -v /var/run/docker.sock:/var/run/docker.sock -v "$(pwd)":"$(pwd)" -w "$(pwd)" -u 0:0 gradle:3.4 ./gradlew test
I can run tests fine with this configuration however I don’t understand how this configuration is able to even run.
Up to this day I thought that whatever commands I put in the script section of docker-runner job are executed inside the container which is specified in image section of that job, in this case docker:latest. Or in case of shell runner - on the host where shell runner is registered.
Apparently this is not the case since docker:latest image does not have a running docker daemon and cannot execute docker run … command. In fact what happens is that gradle image is started in docker:dind container. How the heck script got propagated to docker:dind container which was started as a complementary container via service?