I’ve been using WSL-2 on Windows for over a year. It’s very useful because some Python packages are just a headache to install on Windows. Also, docker. It’s just better on Linux.
Yet, WSL-2 can also be problematic. I remember trying a dual-boot setup when things just went way too much complicated with WSL. For me, WSL is a tool to get other work done. It’s not the end goal, it’s a tool and tools should just work. Anyway, finally with a really good article by Jonathan Bowman I managed to setup the environment I want.
Now, the docker environment works lives in the WSL-2. One small note, the IP of your WSL hosts are not static, they’ll change.
In case you need to use the IP in docker on a WSL host, if localhost
doesnt work, try this instead: host.docker.internal:port
Lastly,
# List wsl hosts
wsl -l -v
wsl --list --verbose
# List hosts with the IP
wsl hostname -I
# Shutdown a certain distro.
wsl -t DISTRO-NAME
wsl --terminate DISTRO-NAME
# Shutdown all hosts.
wsl --shutdown