-
Notifications
You must be signed in to change notification settings - Fork 3
Setting up Docker
The template requires docker.
Because some projects need the CUDA toolkit, we have to use docker-ce inside of WSL rather than Docker Desktop with a WSL backend. (At least as of May 2022). If you don't plan to use a GPU, you can use standard Docker installation protocols.
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo groupadd docker
sudo usermod -aG docker $USER
Now, close your shell and open another for taking the group changes into account
Make sure your /etc/wsl.conf in Ubuntu contains
[boot]
systemd=true
Then, restart WSL by opening powershell and running wsl --shutdown, waiting 8 seconds, then opening another Ubuntu shell.
First, run
docker version
You should get no permissions errors if things went well. If you do get permission errors, try again running as root (e.g., sudo docker version)
You can then try
docker run hello-world
https://docs.docker.com/engine/install/ubuntu/ (seems to be updated)
https://dev.to/felipecrs/simply-run-docker-on-wsl2-3o8 (not being updated, but original way we setup docker-cd in Ubuntu)
