I’m running Ubuntu on WSL2 and was looking to install docker in it. I found this article, “Docker Desktop WSL 2 backend on Windows“, but it is for installing docker on Windows and use WSL2 as the back end.
What I wanted is to install Docker on Ubuntu running on WSL2. So, I followed the article “Install Docker Engine on Ubuntu” and it worked.
The default user in Ubuntu (WSL2) does not have the permission to run any docker commands, so, it’s better to add user to the “docker” group like below, otherwise, you need to execute every Docker commands with sudo
.
usermod -aG
1 docker
2 <username>
newgrp
3 <username>