How to Use Testcontainers Cloud in CI
Testcontainers Cloud runs your containers on remote workers, so the CI runner needs a token instead of a local Docker daemon.
Add the Testcontainers Cloud setup action with a TC_CLOUD_TOKEN. It starts an agent that redirects container operations to the cloud, which helps on runners without local Docker or when you want a warm image cache.
Steps
- Create a Testcontainers Cloud service account token.
- Store it as the
TC_CLOUD_TOKENsecret. - Run the cloud setup action before your tests.
- Run tests unchanged; containers execute in the cloud.
Workflow
.github/workflows/ci.yml
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Testcontainers Cloud
uses: atomicjar/testcontainers-cloud-setup-action@main
with:
token: ${{ secrets.TC_CLOUD_TOKEN }}
- run: mvn -B verifyGotchas
- Test code is unchanged; only where containers run moves to the cloud.
- A warm cloud image cache reduces pull time versus pulling on every ephemeral runner.
Related guides
How to Avoid Docker Hub Pull Rate Limits With Testcontainers in CIAuthenticate to Docker Hub in CI so Testcontainers image pulls are not throttled by anonymous rate limits, us…
How to Cache Testcontainers Images in CIReduce Testcontainers pull time in CI by caching image tarballs with actions/cache and docker save/load, or b…
How to Speed Up Testcontainers Runs in CICut Testcontainers CI time by sharing containers per class, running tests in parallel, caching images, and av…