SoftwareTestPilot
All discussions
Priya GopalJul 12

When should QA use Testcontainers instead of docker-compose?

Both spin containers. What is the actual decision?

dockertestcontainers
Related learningExplore Academy skill paths

1 answer

Accepted solution

Priya GopalJul 13

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.