Tips and Traps
-
Docker on WSL 2 works great. However, the performance of IO is extremely bad if it access the Windows filesystem. For more discussions, please refer to WSL 2 Filesystem .
-
Docker containers launched from a WSL (e.g., Ubuntu) shell will continue to run after the WSL shell is terminated, as long as the Docker daemon is alive. As a matter of fact, a WSL 2 shell is not must to start the Docker daemon (back by WSL 2) or to launch Docker containers.
Install Docker in WSL 2
-
Install WSL 2 following instructions in Tips on WSL 2 .
-
Install
docker.io
in WSL 2.sudo apt-get install docker.io
-
Install Docker desktop for Windows.
-
Set Docker to use WSL 2 based engine.
- Open Docker desktop settings.
- Check the checkbox "Use the WSL 2 based engine" in the general tab.
- Click "Apply & Restart".
For more details, please refer to Docker Desktop WSL 2 backend .
References
-
https://towardsdatascience.com/dual-boot-is-dead-windows-and-linux-are-now-one-27555902a128