Configuration¶
Container runtime access¶
Testcontainers for PHP uses Docker APIs under the hood, so your test process must be able to reach a Docker-compatible daemon.
- Local socket:
unix:///var/run/docker.sock - Remote daemon: configure
DOCKER_HOST
Environment variables¶
DOCKER_HOST¶
Defines where the Docker API is available.
Examples:
1 2 | |
TESTCONTAINERS_HOST_OVERRIDE¶
Overrides the host address returned by Testcontainers when your tests need a custom endpoint:
1 | |
Running inside containers¶
If your tests run inside another container:
- Mount the Docker socket.
- Ensure network routing from test container to started containers is valid.
- Set host overrides when needed for your CI/network topology.
For startup and connectivity failures, see troubleshooting.