Configuration

qianmoQqianmoQ· 更新于 2026-10-19· 阅读 6 分钟· 0 次阅读

登录后可跨设备保存划线和私人笔记登录

Configuration

All possible environment variable configurations for Testcontainers are found here.

Logs

VariableExampleDescription
DEBUGtestcontainers*Enable all logs
DEBUGtestcontainersEnable testcontainers logs
DEBUGtestcontainers:containersEnable container logs
DEBUGtestcontainers:composeEnable compose logs
DEBUGtestcontainers:buildEnable build logs
DEBUGtestcontainers:pullEnable pull logs
DEBUGtestcontainers:execEnable container exec logs

Note that you can enable multiple loggers, e.g: DEBUG=testcontainers,testcontainers:exec.

Docker

Configuration of the Docker daemon:

VariableExampleDescription
DOCKER_HOSTtcp://docker:2375Set the URL of the docker daemon
DOCKER_TLS_VERIFY1Enable/disable TLS communication with the docker daemon
DOCKER_CERT_PATH/some/pathConfigures the path to the files used for TLS verification
DOCKER_CONFIG/some/pathConfigures the path to the config.json file for authentication
DOCKER_AUTH_CONFIG{"auths":{"https://registry.example.com":{"username":"","password":""}}}JSON string representation of the config.json file, takes precedence for authentication

Testcontainers

Configuration of Testcontainers and its behaviours:

VariableExampleDescription
TESTCONTAINERS_HOST_OVERRIDEtcp://docker:2375Docker's host on which ports are exposed
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE/var/run/docker.sockPath to Docker's socket used by ryuk
TESTCONTAINERS_RYUK_PRIVILEGEDtrueRun ryuk as a privileged container
TESTCONTAINERS_RYUK_DISABLEDtrueDisable ryuk
TESTCONTAINERS_RYUK_PORT65515Set ryuk host port (not recommended)
TESTCONTAINERS_SSHD_PORT65515Set SSHd host port (not recommended)
TESTCONTAINERS_HUB_IMAGE_NAME_PREFIXmycompany.com/registrySet default image registry
RYUK_CONTAINER_IMAGEtestcontainers/ryuk:0.14.0Custom image for ryuk
SSHD_CONTAINER_IMAGEtestcontainers/sshd:1.4.0Custom image for SSHd
TESTCONTAINERS_REUSE_ENABLEtrueEnable reusable containers
TESTCONTAINERS_RYUK_VERBOSEtrueSets RYUK_VERBOSE env var in ryuk container
TESTCONTAINERS_RYUK_RECONNECTION_TIMEOUT30sSets RYUK_RECONNECTION_TIMEOUT env var in ryuk container

评论

登录后参与评论

正在加载评论…