Skip to content

Instantly share code, notes, and snippets.

@Trass3r
Created August 1, 2023 16:44
Show Gist options
  • Save Trass3r/c5700b3f1b7abe783fd20423a7de5f10 to your computer and use it in GitHub Desktop.
Save Trass3r/c5700b3f1b7abe783fd20423a7de5f10 to your computer and use it in GitHub Desktop.
setup Docker in WSL2
# https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
sudo apt update
sudo apt install -y 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
echo "# allow starting the docker daemon without password\n%docker ALL=(ALL) NOPASSWD: /usr/bin/dockerd" >> /etc/sudoers
# put into ~/.bashrc:
if [ ! -S /var/run/docker.sock ]; then
nohup sudo -b dockerd < /dev/null > ~/dockerd.log 2>&1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment