Skip to content

Commit b7e9bb6

Browse files
authored
Update GitLab CI docs: Add --tls=false to docker-in-docker to avoid startup delays (#4573)
1 parent 92155d9 commit b7e9bb6

File tree

1 file changed

+6
-2
lines changed
  • docs/supported_docker_environment/continuous_integration

1 file changed

+6
-2
lines changed

docs/supported_docker_environment/continuous_integration/gitlab_ci.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
# GitLab CI
22

33
In order to use Testcontainers in a Gitlab CI pipeline, you need to run the job as a Docker container (see [Patterns for running inside Docker](dind_patterns.md)).
4-
So edit your `.gitlab-ci.yml` to include the [Docker-In-Docker service](https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-in-docker-workflow-with-docker-executor) (`docker:dind`) and set the `DOCKER_HOST` variable to `tcp://docker:2375` and `DOCKER_TLS_CERTDIR` to empty string.
4+
So edit your `.gitlab-ci.yml` to include the [Docker-In-Docker service](https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-in-docker-workflow-with-docker-executor) (`docker:dind`) and set the `DOCKER_HOST` variable to `tcp://docker:2375` and `DOCKER_TLS_CERTDIR` to empty string.
5+
6+
Caveat: Current docker releases (verified for 20.10.9) intentionally delay the startup, if the docker api is bound to a network address but not TLS protected. To avoid this delay, the docker process needs to be started with the argument `--tls=false`. Otherwise jobs which access the docker api at the very beginning might fail.
57

68
Here is a sample `.gitlab-ci.yml` that executes test with gradle:
79

810
```yml
911
# DinD service is required for Testcontainers
1012
services:
11-
- docker:dind
13+
- name: docker:dind
14+
# explicitly disable tls to avoid docker startup interruption
15+
command: ["--tls=false"]
1216

1317
variables:
1418
# Instruct Testcontainers to use the daemon of DinD.

0 commit comments

Comments
 (0)