Custom configuration¶
You can override some default properties if your environment requires that.
Configuration locations¶
The configuration may be loaded from multiple locations. Properties are considered in the following order:
- Environment variables
~/.testcontainers.propertiesfile (a Java properties file, enabled by theproperties-configfeature) Example locations:
Linux:/home/myuser/.testcontainers.properties
Windows:C:/Users/myuser/.testcontainers.properties
macOS:/Users/myuser/.testcontainers.properties
Docker host resolution¶
The host is resolved in the following order:
- Docker host from the
tc.hostproperty in the~/.testcontainers.propertiesfile. DOCKER_HOSTenvironment variable.- Docker host from the "docker.host" property in the
~/.testcontainers.propertiesfile. - Else, the default Docker socket will be returned.
Docker authentication¶
Sometimes the Docker images you use live in a private Docker registry. For that reason, Testcontainers for Rust gives you the ability to read the Docker configuration and retrieve the authentication for a given registry. Configuration is fetched in the following order:
DOCKER_AUTH_CONFIGenvironment variable, unmarshalling the string value from its JSON representation and using it as the Docker config.DOCKER_CONFIGenvironment variable, as an alternative path to the directory containing Dockerconfig.jsonfile.- else it will load the default Docker config file, which lives in the user's home, e.g.
~/.docker/config.json.
bollard, rustls and SSL Cryptography providers¶
testcontainers uses bollard to interact with the Docker API.
bollard in turn has options provided by rustls to configure its SSL cryptography providers.
The testcontainers feature flags to control this are as follows:
ring- userustlswithringas the cryptography provider (default)aws-lc-rs- userustlswithaws-lc-rsas the cryptography providerssl- userustlswith a custom cryptography provider configuration - see bollard and rustls documentation for more.
Podman Docker compatibility¶
Install podman + podman-docker packages for your system.
systemctl --user enable podman.socket
systemctl --user start podman.socket
systemctl --user status podman.socket
export DOCKER_HOST=unix:///run/user/$UID/podman/podman.sock