Aqui vou deixar o que é necessario para configurar o docker nativo do linux através de ubunto e wsl2 no IntteliJIDE
- Exponha o daemon no seu wsl
sudo echo '{"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]}' > /etc/docker/daemon.json
- Crie o arquivo .testcontainers.properties em C:\Users\SeuUser
docker.client.strategy = org.testcontainers.dockerclient.EnvironmentAndSystemPropertyClientProviderStrategy
docker.host = tcp://[::1]:2375
docker.cert.path = \\wsl$\home\SeuUserLinux\.docker
ryuk.container.privileged = false
- Adicione as seguintes variaveis de ambiente no Windowns.
1. DOCKER_CERT_PATH = \\wsl$\home\$seu.usuario.do.linux\.docker
2. DOCKER_HOST = tcp://[::1]:2375
3. DOCKER_TLS_VERIFY = 10
4. TESTCONTAINERS_RYUK_DISABLED = true
- https://lightrun.com/answers/testcontainers-testcontainers-java-cant-connect-to-docker-running-in-wsl2-vm-if-testcontainers-runs-on-windows-and-docker-desktop-is-n
- https://gist.github.com/sz763/3b0a5909a03bf2c9c5a057d032bd98b7
- https://www.testcontainers.org/features/configuration/#customizing-docker-host-detection
- testcontainers/testcontainers-java#3887
- docker/for-win#3570
- https://forums.docker.com/t/wsl-and-docker-for-windows-cannot-connect-to-the-docker-daemon-at-tcp-localhost-2375-is-the-docker-daemon-running/63571/15
- testcontainers/testcontainers-java#3609
- https://lightrun.com/answers/testcontainers-testcontainers-java-lima-containers-havent-been-removed-after-tests-finished-
- https://www.testcontainers.org/features/configuration/
- testcontainers/testcontainers-java#1399
- testcontainers/testcontainers-java#3609