Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for using Gitlab CI with Docker wormhole executor #4770

Merged
merged 5 commits into from
May 18, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# GitLab CI

## example with docker.sock
JurrianFahner marked this conversation as resolved.
Show resolved Hide resolved
If you have your own docker runner installed, and you have `/var/run/docker.sock` mounted in the gitlabrunner.
JurrianFahner marked this conversation as resolved.
Show resolved Hide resolved

See below for example configuration for your own docker gitlab runner:
JurrianFahner marked this conversation as resolved.
Show resolved Hide resolved
```toml
[[runners]]
name = "MACHINE_NAME"
url = "https://gitlab.com/"
token = "GENERATED_GITLAB_RUNNER_TOKEN"
executor = "docker"
[runners.docker]
tls_verify = false
image = "docker:latest"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]
shm_size = 0
```

Please include the following in the test task for `.gitlab-ci.yml`:
JurrianFahner marked this conversation as resolved.
Show resolved Hide resolved
```yml
variables:
TESTCONTAINERS_HOST_OVERRIDE: "host.docker.internal"
```

The environment variable `TESTCONTAINERS_HOST_OVERRIDE` needs to be configured otherwise a wrong ip address would be
assigned to resolve the host of the runner, which could lead to failing tests.
JurrianFahner marked this conversation as resolved.
Show resolved Hide resolved

## example with dind - docker-in-docker service
JurrianFahner marked this conversation as resolved.
Show resolved Hide resolved

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)).
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.

Expand Down