1. Help Center
  2. Testcontainers Cloud for CI

How to use Testcontainers Cloud with GitLab CI/CD

Make sure TC_CLOUD_TOKEN is set to your corresponding token value, download the agent and start it.

To use Testcontainers Cloud with GitLab you need to set TC_CLOUD_TOKEN to your corresponding service account token. You can generate the token in the Testcontainers Cloud dashboard. Then add the token to your GitLab job by setting environment variable in your GitLab Project Settings

Next you need to configure your GitLab pipeline job to install and use Testcontainers Cloud. You can use the Testcontainers Cloud agent installation script and start it before running your tests.

You can use the following configuration for your .gitlab-ci.yml:

image: "docker-image:tag" # ex: maven:3-eclipse-temurin-19

job_name:
stage: test
script:
- curl -fsSL https://app.testcontainers.cloud/bash | bash
- # ... existing steps go here (run tests, etc.)