When should QA use Testcontainers instead of docker-compose?
Both spin containers. What is the actual decision?
dockertestcontainers
Both spin containers. What is the actual decision?
Accepted solution
Testcontainers when the containers' lifecycle is per-test (spin a fresh Postgres for each test class, throw it away after). docker-compose when the environment is shared by the whole suite and started once (a Selenium Grid, a full staging stack). Testcontainers gives you test isolation and cleanup for free; compose gives you speed for shared long-running services.