Are using TestContainers safe for integration tests?
I think the question about Docker security in general was already well answered in other places, for example here: https://stackoverflow.com/questions/40844197/what-is-the-docker-security-risk-of-var-run-docker-sock

In your particular instance, I see the following points:


The tests should run on some testing server, possibly even in a VM that is destroyed/reset after each test run, so possible accidents/incidents should not affect other systems
For an attacker to use this setup, they would probably (depending on your tests) need to be able to modify your test code and if they are able to do so, you will already have much bigger problems than privileged Docker access