testcontainers-java: wait until container started - doesn't end and in the meantime creates multiple containers (MySQLContainer)

I tried this simple code: try (MySQLContainer mySQLContainer = new MySQLContainer()) { mySQLContainer.start(); mySQLContainer.stop(); } In the log I get: [INFO] 2017-12-05 16:50:48,709 [main] 🐳 [mysql:latest] waitUntilContainerStarted - Waiting for database connection to become available at jdbc:mysql://localhost:32770/test using query ‘SELECT 1’

And in the meantime containers are created every 2 min: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS 7504e73de3d5 mysql:latest “docker-entrypoint…” 11 minutes ago Up 11 minutes 0.0.0.0:32770->3306/tcp 1ae62c3a699c mysql:latest “docker-entrypoint…” 13 minutes ago Up 13 minutes 0.0.0.0:32769->3306/tcp

Am I doing something wrong. Tries both on docker on windows and docker on ubuntu and got the same results

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

I fixed this by adding the mysql connector dependency to my test.