I have just upgraded to WSL2 on Windows 10 (latest build). I have installed the latest version of Docker for Windows (19.03.13), and uninstalled and re-installed the docker engine on my Ubuntu 18 image to match the Windows build. However, unlike my experience with WSL, now I find I can only run docker container commands as root – prefacing everything with sudo. Otherwise I get an error message saying “Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?.”
I saw an article mentioning that the docker daemon runs as root and to run as user you have to add yourself to the docker group. However, this group already exists and adding myself to it hasn’t fixed it (I was probably already in it). I saw some posts saying you had to delete stale symlinks, but this didn’t help either.
I did encounter an article saying docker should in fact only ever be run as root, but I think this really refers to production environments. It doesn’t appear to be normal to do that in a development environment. I’d be grateful if anyone could suggest a way of running docker as a regular user.
Source: Docker Questions