1. Install curl
First, ensure curl is installed on your system:
sudo apt install -y curl
2. Install Docker via Shell Script
You can install Docker using a shell script from a GitHub repository:
curl -s https://raw.githubusercontent.com/karaage0703/ubuntu-setup/master/install-docker.sh | /bin/bash
3. Manual Docker Installation Steps
If you prefer to install Docker manually, follow these steps:
Update Package Index
sudo apt-get update
Install Prerequisite Packages
sudo apt-get -y install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
Add Docker's Official GPG Key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Verify the GPG Key
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Update Package Index Again
sudo apt-get update
Install Docker Engine, CLI, and Containerd
sudo apt-get -y install docker-ce docker-ce-cli containerd.io
Install Docker Compose Plugin
sudo apt-get -y install docker-compose-plugin
Add Your User to the Docker Group
sudo gpasswd -a $USER docker
4. Start docker on WSL2
sudo service docker start
Top comments (1)
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