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.