Testcontainers do not start after replacing Docker Desktop with minikube

Viewed 1517

I want to make my testcontainers in Java integration tests work with minikube replacing Docker Desktop.

I followed below article to get started: https://www.atomicjar.com/2021/10/docker-on-windows-and-macos/#minikube

This is what I've got in testcontainers.properties

docker.client.strategy=org.testcontainers.dockerclient.EnvironmentAndSystemPropertyClientProviderStrategy
docker.host=tcp\://192.168.64.2\:2376
docker.cert.path=/Users/username/.minikube/certs
docker.tls.verify=true

Although my docker is up and running, I'm getting following exception:

Caused by: java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration

Can anybody please suggest anything to make it working?

TA

2 Answers

If you are using gradle try -no-daemon flag to use a new daemon. Your old gradle daemon still using your previous testcontainers properties, also restart your IDE if you're running your build inside.

After restarting Minikube and Intellij editor, and updating testcontainer-bom to be the latest - from 1.15 to 1.16.2, I was able to pull some third-party docker images. This means docker is working now.

However, I'm still trying to find a way to work with local images (Other application docker images) for integration testing as it used to work with Docker Desktop.

Related