testcontainers-node icon indicating copy to clipboard operation
testcontainers-node copied to clipboard

testcontainer not reusing container if stopped

Open ibnumusyaffa opened this issue 1 year ago • 1 comments

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

ibnumusyaffa avatar Jun 22 '24 14:06 ibnumusyaffa

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!

cristianrgreco avatar Jun 22 '24 15:06 cristianrgreco

I've taken a stab at this in #849. Had some issues with bound ports, but think I found an okay solution

cbrevik avatar Oct 24 '24 19:10 cbrevik