testcontainers / testcontainers-node

Testcontainers is a NodeJS library that supports tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
https://testcontainers.com
MIT License
1.82k stars 176 forks source link

testcontainer not reusing container if stopped #783

Open ibnumusyaffa opened 1 month ago

ibnumusyaffa commented 1 month ago

Hi, thanks for the great libraries. Why does Testcontainers not reuse containers if they are stopped? Is this a bug or some limitation? My expectation is that Testcontainers just start existing stopped containers instead of creating new ones

Thank you

cristianrgreco commented 1 month ago

Hello! It is a good point. The use case just hasn't come up until now 🙂 The implementation currently only looks for running containers. It would be easy enough to remove this filter and if the container is stopped, start it. PR is welcome!