gitlab-ci-local icon indicating copy to clipboard operation
gitlab-ci-local copied to clipboard

Illutrate how docker build with dind service works

Open cs35-owncloud opened this issue 3 years ago • 3 comments

Hello,

since version 4.32.0 is out, I've noticed my jobs are taking a looooong time to run with DIND.

Minimal .gitlab-ci.yml illustrating the issue

---

image: docker:20.10.16-dind

services:
  - docker:dind

job:
  script:
    - docker --version

.gitlab-ci-local-env

VOLUME="/var/run/docker.sock:/var/run/docker.sock"

Expected behavior

With gitlab-ci-local 4.31.0:

$ gitlab-ci-local
git remote -v didn't provide valid matches
parsing and downloads finished in 31 ms
job starting docker:20.10.16-dind (test)
job pulled docker:20.10.16-dind in 2.51 s
job pulled docker:dind in 31 ms
job started service image: docker:dind with aliases: docker in 1.12 s
job service image: docker:dind healthcheck passed: docker:2375 in 847 ms
job service image: docker:dind healthcheck passed: docker:2376 in 839 ms
job copied to container in 443 ms
job $ docker --version
job > Docker version 20.10.16, build aa7e414
job finished in 8.76 s

 PASS  job
pipeline finished in 8.83 s

This job takes ~9s to run, it's fine !

With gitlab-ci-local 4.32.0:

$ gitlab-ci-local
git remote -v didn't provide valid matches
parsing and downloads finished in 33 ms
job starting docker:20.10.16-dind (test)
job started service image: docker:dind with aliases: docker in 1.16 s
job > still running...
job > still running...
job > still running...
job service image: docker:dind healthcheck failed: docker:2375 in 31 s
job > still running...
job > still running...
job > still running...
job service image: docker:dind healthcheck failed: docker:2376 in 31 s
job copied to container in 494 ms
job $ docker --version
job > Docker version 20.10.16, build aa7e414
job finished in 1.12 min

 PASS  job
pipeline finished in 1.12 min

Healthchecks are taking a long time.

Host information Linux Mint 19.1 Docker version 20.10.9

Additional context Add any other context about the problem here.

Thanks !

cs35-owncloud avatar Jun 23 '22 08:06 cs35-owncloud

Read up on the DIND without TLS quirk Previous healthchecking wasn't working at all...

You basicly just need to add Docker TLS variables.

I should probably add an example on how to do this properly in examples/

gitlab.com have their runners setup in a very perticular way, so no one notices its actually being done 😁

firecow avatar Jun 23 '22 10:06 firecow

Thanks for your answer !

Maybe it's the problem, I'm checking, I'm just surprised the behavior changed across gitlab-ci-local version :thinking:

Indeed, I have several self hosted gitlab runners and I had to tune /etc/gitlab-runner/config.toml to have it running.

It would be nice idea to add an example ! :)

cs35-owncloud avatar Jun 23 '22 11:06 cs35-owncloud

Can you elaborate on this? I'm not sure how to get it to work. 4.31.0 will pull images but then reports: Error response from daemon: set shim OOM score. 4.32.0 never manages to healthcheck 2376 (although 2375 works)

benbenbenbenbenben avatar Aug 03 '22 00:08 benbenbenbenbenben

I've been racking my brain trying to figure out why I am still having this same issue on the latest version. But then I realized this patch is not included in v4.33.1 😄

Can you create a new release for package managers to get this fix? 🙏

haydenseitz avatar Sep 30 '22 17:09 haydenseitz

Oh, right :D Yeah, sorry releasing now. @haydenseitz

firecow avatar Sep 30 '22 19:09 firecow