Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cesarcf/c02ffa95bf3d564b2671ebb80d949fa5 to your computer and use it in GitHub Desktop.
Save cesarcf/c02ffa95bf3d564b2671ebb80d949fa5 to your computer and use it in GitHub Desktop.
Install Docker in Ubuntu 21.10, Install Dockercompose on Ubuntu 21.10
# [🟨OPTIONAL] Uninstall old docker versions
sudo apt-get remove docker docker-engine docker.io containerd runc
# Refresh latest version
sudo apt-get update
# Install pre-req
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
# Add docker official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# x86 and amd_64 HERE WE CHANGE
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
# Install docker
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# Give docker permissions
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
# Check version
docker --version
# Check if installed
sudo docker run hello-world
# If still fails, reboot OS
# Downloand docker compose stable
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# Apply executable to binary
sudo chmod +x /usr/local/bin/docker-compose
# Check version
docker-compose --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment