- DATE:
- AUTHOR:
- The AtomicJar team
Clean up containers without manual docker commands
By default, Testcontainers libraries spin up ephemeral containers that are automatically cleaned up when your tests complete. However, if you rely on reusable containers to speed up your tests and local development, you sometimes need to clean them up manually. The typical approach involves remembering a non-trivial command in the CLI, such as: docker kill $(docker ps --format "{{.ID}}")
.
Testcontainers Desktop now includes a simple option to "Terminate containers" that cleans up all running Testcontainers-powered containers, while sparing other vanilla containers. Besides cleaning-up reusable containers, this also comes in handy when freezing container shutdown: simply terminate containers when you're done debugging them.