How to reuse Testcontainers between multiple SpringBootTests?

You can’t use the JUnit Jupiter annotation @Container if you want to have reusable containers. This annotation ensures to stop the container after each test. What you need is the singleton container approach, and use e.g. @BeforeAll to start your containers. Even though you then have .start() in multiple tests, Testcontainers won’t start a new … Read more

Test Container test cases are failing due to “Could not find a valid Docker environment”

In my case this error caused by root permission. If you are using ubuntu, docker wants permission to create container and testcontainers can not ask you for this permission at runtime. So you need to make docker runnable without sudo. Try this steps to create docker group and add connected user: $ sudo groupadd docker … Read more