testcontainers-go
testcontainers-go copied to clipboard
Containers created by Docker Compose are not cleaned by Ryuk
Containers created and started by testcontainers-go through Docker Compose are not guaranteed to be cleaned up (and this is something I personally observed when running the testcontainers-go test suite on WSL), since Ryuk is not aware of them.
We solved this issue in testcontainers-java by registering the project label added by Docker Compose with Ryuk: https://github.com/testcontainers/testcontainers-java/blob/76f11b344ce42ad920828b0628a7ec929a9d0eca/core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java#L312
See my comments on a possible update here: https://github.com/testcontainers/testcontainers-go/pull/465#issuecomment-1460018701
Hey, I came across this problem recently. For the time being I fixed it within our code by having our helper code create an intermediate docker compose file with the reaper labels added for all the services.
Not the most elegent solution, but works nicely and is mostly transparent to the user. Thought i'd post it here in case it is useful in the future