Docker Engine on WSL + Visual Studio 2019 without Docker Desktop



Prerequisite

  • Install WSL version 2 (see Microsoft documentation)

  • Install Linux (personally I choose Ubuntu)

  • Install Visual Studio 2019

  • Clone this repository


Configure WSL

You maybe need to configure WSL to limit processor and memory usage.

This can be done with the file .wslconfig in your Windows profile folder (%USERPROFILE%).

[wsl2]
memory=4GB # Limits VM memory in WSL 2 up to 4GB
processors=2 # Makes the WSL 2 VM use two virtual processors

See Microsoft documentation.


Install Docker tools


Install Docker

From Docker documentation :

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo docker run hello-world

You will have an error here :