DEV Community

0xkoji
0xkoji

Posted on • Edited on

Install Docker on WSL2

1. install curl

sudo apt install -y curl
Enter fullscreen mode Exit fullscreen mode

2. install docker via shell script

$ curl -s https://raw.githubusercontent.com/karaage0703/ubuntu-setup/master/install-docker.sh | /bin/bash
Enter fullscreen mode Exit fullscreen mode
#!/bin/bash
# Reference sites
# https://qiita.com/gen10nal/items/1e7fe8a1b2e9ad1e7919
# https://docs.docker.com/engine/install/ubuntu/

sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get -y install docker-ce docker-ce-cli containerd.io
sudo apt-get -y install docker-compose-plugin
sudo gpasswd -a $USER docker
Enter fullscreen mode Exit fullscreen mode

3 start docker on WSL2

sudo service docker start
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
javieraguerocl profile image
Javier Aguero

permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.47/containers/json": dial unix /var/run/docker.sock: connect: permission denied