docker.sock:在 Windows 上将 testContainers 与 Podman 一起使用时权限被拒绝

rio*_*rio 5 permissions containers testcontainers podman

我的 Java 和 Spring Boot 应用程序集成测试使用testContainers并且我在 Windows 计算机上使用Podman 。

当尝试运行集成测试时,我收到此权限错误:

Failed to load ApplicationContext
    java.lang.IllegalStateException: Failed to load ApplicationContext
 .....
Caused by: com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: {"cause":"permission denied","message":"container create: statfs /var/run/docker.sock: permission denied","response":500}
Run Code Online (Sandbox Code Playgroud)

所有集成测试都失败了。

我需要向 Podman 提供特定的权限命令吗?

rio*_*rio -2

我从 Podman 切换到Rancher Desktop后才解决了这个问题。