-
Notifications
You must be signed in to change notification settings - Fork 15
Install docker on WSL without docker desktop
Clément Bareth-Desgranges edited this page Dec 14, 2022
·
2 revisions
Reference doc : Install Docker in WSL 2 without Docker Desktop — Nick Janetakis
sudo apt-get install curl git
#!/bin/sh
rm -rf installation-docker-temp
mkdir installation-docker-temp
cd installation-docker-temp
# Install Docker, you can ignore the warning from Docker about using WSL
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# Add your user to the Docker group
sudo usermod -a -G docker $USER
# Install Docker Compose v2
sudo apt-get update && sudo apt-get install docker-compose-plugin
# Sanity check that both tools were installed successfully
docker --version
docker compose version
# Using Ubuntu 22.04 or Debian 10 / 11? You need to do 1 extra step for iptables
# compatibility, you'll want to choose option (1) from the prompt to use iptables-legacy.
sudo update-alternatives --config iptables
cd ../ && rm -rf installation-docker-temp
sudo sh install-docker.sh
%docker ALL=(ALL) NOPASSWD: /usr/bin/dockerd
Close all WSL terminals an update all VMs :
wsl --update
Once this operation is complete, find out about the /etc/wsl.conf file in the distribution's filesystem with the following line (if the file does not exist, create it) :
[boot]
systemd=true
In PowerShell restart the VM :
wsl.exe --shutdown
Once the distribution is relaunched, normally the systemd command is now active. We must now enable the automatic start of the docker service:
sudo systemctl enable docker
Link to original documentation : Systemd support is now available in WSL! - Windows Command Line