[DEV] 기록

[Springboot] Mac에서 TestContainers Docker 감지 못할 때 해결 방법

꾸준함. 2025. 4. 24. 16:54

개요

Docker Desktop이 실행 중임에도 불구하고 테스트 코드를 실행할 때 다음과 같은 에러가 발생했습니다.

 

ERROR [Alice]: o.t.d.DockerClientProviderStrategy - Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
ERROR [Alice]: o.t.d.DockerClientProviderStrategy - UnixSocketClientProviderStrategy: failed with exception InvalidConfigurationException (Could not find unix domain socket). Root cause NoSuchFileException (/var/run/docker.sock)
ERROR [Alice]: o.t.d.DockerClientProviderStrategy - As no valid configuration was found, execution cannot continue
java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration
view raw .js hosted with ❤ by GitHub

 

해결 방법

Mac OS의 경우 다음 명령어를 터미널에 입력하면 문제가 해결됩니다.


sudo ln -s $HOME/.docker/run/docker.sock /var/run/docker.sock
view raw .js hosted with ❤ by GitHub

 

출처

https://java.testcontainers.org/supported_docker_environment/

 

General Container runtime requirements - Testcontainers for Java

General Container runtime requirements Overview To run Testcontainers-based tests, you need a Docker-API compatible container runtime, such as using Testcontainers Cloud or installing Docker locally. During development, Testcontainers is actively tested ag

java.testcontainers.org

반응형