DEV Community

Indra Wahyu
Indra Wahyu

Posted on

Run Docker Without sudo in WSL2

My problem is, when run docker has a problem like this

permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json": dial unix /var/run/docker.sock: connect: permission denied
Enter fullscreen mode Exit fullscreen mode

I solve with this

sudo addgroup --system docker
sudo adduser $USER docker
newgrp docker
sudo chown root:docker /var/run/docker.sock
sudo chmod g+w /var/run/docker.sock
Enter fullscreen mode Exit fullscreen mode

reference

Top comments (0)