Skip to content

Commit b8d75b1

Browse files
Add docs for using Gitlab CI with Docker wormhole executor (#4770)
1 parent ada816c commit b8d75b1

File tree

1 file changed

+31
-0
lines changed
  • docs/supported_docker_environment/continuous_integration

1 file changed

+31
-0
lines changed

docs/supported_docker_environment/continuous_integration/gitlab_ci.md

+31
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# GitLab CI
22

3+
## Example using Docker socket
4+
This applies if you have your own GitlabCI runner installed, use the Docker executor and you have `/var/run/docker.sock` mounted in the runner configuration.
5+
6+
See below for an example runner configuration:
7+
```toml
8+
[[runners]]
9+
name = "MACHINE_NAME"
10+
url = "https://gitlab.com/"
11+
token = "GENERATED_GITLAB_RUNNER_TOKEN"
12+
executor = "docker"
13+
[runners.docker]
14+
tls_verify = false
15+
image = "docker:latest"
16+
privileged = false
17+
disable_entrypoint_overwrite = false
18+
oom_kill_disable = false
19+
disable_cache = false
20+
volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]
21+
shm_size = 0
22+
```
23+
24+
Please also include the following in your GitlabCI pipeline definitions (`.gitlab-ci.yml`) that use Testcontainers:
25+
```yml
26+
variables:
27+
TESTCONTAINERS_HOST_OVERRIDE: "host.docker.internal"
28+
```
29+
30+
The environment variable `TESTCONTAINERS_HOST_OVERRIDE` needs to be configured, otherwise, a wrong IP address would be used to resolve the Docker host, which will likely lead to failing tests.
31+
32+
## Example using DinD (Docker-in-Docker)
33+
334
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)).
435
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.
536

0 commit comments

Comments
 (0)