This article explains how the Testcontainers Cloud Agent relies on the ~/.testcontainers.properties file to inform the Testcontainers libraries that they should prefer Testcontainers Cloud.
Sometimes a system has access to both a Docker daemon and Testcontainers Cloud. To resolve which Docker environment to use Testcontainers libraries do the following in order:
- Obtain Docker location from the environment variable DOCKER_HOST
- Read the ~/.testcontainers.properties file (if it exists):
- Find the Docker location is from its docker.host property
- Fall back to trying the default Docker locations for the current operating system
Testcontainers Cloud Agent, both Desktop and CI, configures its own location in the ~/.testcontainers.properties file, which makes the tests automatically prefer it, unless the user explicitly defined a DOCKER_HOST environment variable.
You can also configure individual projects not to consider the configuration in the ~/.testcontainers.properties file.