- powershell
- windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11 (If you are on earlier versions please see the manual install page)
Run with administrator mode:
wsl --install
Restart the machine.
You can have multiples linux distributions but you need to set one distribution as default
Replace
Ubuntu-22.04
with your choosen linux distribution
Run this commmand to list avaliable linux distributions:
wsl --list --online
Choose one distribution and run the code bellow, replacing with your distribution:
wsl --install --distribution Ubuntu-22.04
After install you can see the downloaded distribution with the list command:
wsl --list
Setup credentials to super user.
Replace
Ubuntu-22.04
with your linux distribution
Start wsl running the code:
wsl -d Ubuntu-22.04
Login with su
and update:
sudo su
apt-get update
apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release \
net-tools
mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update | apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
To access the container from windows get the ip eth0 (inet adress) at wsl environment:
ifconfig eth0