Skip to content

Instantly share code, notes, and snippets.

@jasenmichael
Last active November 5, 2023 01:08
Show Gist options
  • Save jasenmichael/aa126356309381d02bdfab79e1052f86 to your computer and use it in GitHub Desktop.
Save jasenmichael/aa126356309381d02bdfab79e1052f86 to your computer and use it in GitHub Desktop.
quickly install docker for pop_os (tested on 20.04)
#! /bin/bash
if [[ -z $1 ]] || [[ "$1" != "-r" ]] && [[ "$1" != "--reinstall" ]]; then
type docker >/dev/null 2>&1 && echo "Docker already installed, exiting" && exit 0
fi
echo "Installing Docker..."
sleep 2
# from the docker website - Install Docker Engine on Ubuntu
# https://docs.docker.com/engine/install/ubuntu/
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings > /dev/null 2> /dev/null
[[ -f /etc/apt/keyrings/docker.gpg ]] && sudo rm /etc/apt/keyrings/docker.gpg
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo chmod a+r /etc/apt/keyrings/docker.gpg
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo ln -s /usr/libexec/docker/cli-plugins/docker-compose /usr/bin/docker-compose
sudo groupadd docker
sudo usermod -aG docker $USER
sudo chown "$USER":"$USER" /home/"$USER"/.docker -R &> /dev/null
sudo chmod g+rwx "$HOME/.docker" -R &> /dev/null
# check if docker installed
# type docker >/dev/null 2>&1 && echo "Docker installed successfully" || echo "Docker installation failed" && exit 1
# if [ -x "$(command -v docker)" ]; then
if [[ $(which docker) && $(docker --version) ]]; then
echo "Docker installed successfully"
# make the docker group available immediately
newgrp docker
exit 0
else
echo "Docker installation failed"
exit 1
fi
@jasenmichael
Copy link
Author

jasenmichael commented Nov 25, 2022

curl -fsSL https://gist.githubusercontent.com/jasenmichael/aa126356309381d02bdfab79e1052f86/raw/5b8b866e4c004121cee635537d88d66a6941da1e/popos-get-docker.sh
chmod +x ~/popos-get-docker.sh
~/popos-get-docker.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment