Docker/Docker in WSL

From Omnia
Jump to navigation Jump to search

Docker in WSL

#/bin/bash

# 1. Required dependencies
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl gnupg lsb-release

# 2. GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

# 3. Use stable repository for Docker
echo \
  "deb [arch=$(dpkg --print-architecture) 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

# 4. Install Docker
sudo apt-get update
sudo apt-get -y install docker-ce docker-ce-cli containerd.io

# 5. Add user to docker group
sudo groupadd docker
sudo usermod -aG docker $USER

Ref: [1]

Additional steps: (doesn't seem to start docker automatically)

# 6. Start Docker:
sudo service docker start
sudo service docker status

sudo docker ps