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

Containers created by Docker Compose are not cleaned by Ryuk

Open kiview opened this issue 4 years ago • 2 comments

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

kiview avatar Oct 27 '21 16:10 kiview

See my comments on a possible update here: https://github.com/testcontainers/testcontainers-go/pull/465#issuecomment-1460018701

mdelapenya avatar Mar 08 '23 11:03 mdelapenya

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

lwaddicor avatar Apr 25 '23 13:04 lwaddicor