Error when running Docker command in WSL Ubunut dial unix /var/run/docker.sock : connect: permission denied

if you get this error dial unix /var/run/docker.sock: connect: permission denied‘ when you run docker command in WSL Ubuntu. From the exception you can tell it is a permission issue. For my case below are the steps to fix it.

> sudo groupadd docker
> sudo usermod -aG docker $USER
> sudo chown root:docker /var/run/docker.sock

Restart your WSL terminal.
  •  
  •  
  •  
  •  

Viet Luu has written 308 articles

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

We are thankful for your never ending support.