1. Help Center
  2. Testcontainers Cloud for CI

How to start the Testcontainers Cloud agent in CI job?

To use Testcontainers Cloud in your CI environment please add a step to your CI job that starts the Testcontainers Cloud agent before you run your tests. Do not forget to set your Testcontainers Cloud token as well.

It is also recommended that you make use of the built-in wait command to block until a successful connection to Testcontainers Cloud has been established, so you can be confident that your tests will interact with Testcontainers Cloud in a ready state:

# get the agent binary and execute it immediately 
sh -c "$(curl -fsSL https://get.testcontainers.cloud/bash)"

# run your Testcontainers powered tests as usual
mvn verify

You also need to set your Testcontainers Cloud token. For many environments, the most convenient way is using an environment variable, TC_CLOUD_TOKEN. However, please keep the token as secret as possible.