riorio
riorio

Reputation: 6826

docker.sock: permission denied when using testContainers with Podman on Windows

My Java & Spring Boot application integration tests use testContainers and I'm using Podman on my Windows machine.

When trying to run the integration tests, I'm getting this permission error:

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}

And all the integration tests fail.

Is there a specific permission command I need to provide Podman?

Upvotes: 6

Views: 2302

Answers (2)

user3696412
user3696412

Reputation: 1419

I ran into the same problem trying to use testcontainers with dontet on Windows and was able to solve this by running (in a normal, non-admin terminal)

podman machine set --rootful

Be aware of potential side-effects and check the docs: https://docs.podman.io/en/latest/markdown/podman-machine-set.1.html#rootful

With this setting, testcontainers run nicely for me.

Upvotes: 0

riorio
riorio

Reputation: 6826

I was able to overcome the issue only after switching from Podman to Rancher Desktop.

Upvotes: -2

Related Questions