Skip to content

Instantly share code, notes, and snippets.

@welel
Created November 4, 2023 14:21
Show Gist options
  • Save welel/f80c96482e3b539487b9fa08bfcab86d to your computer and use it in GitHub Desktop.
Save welel/f80c96482e3b539487b9fa08bfcab86d to your computer and use it in GitHub Desktop.
Install Docker (with Docker Compose) on Ubuntu
#!/bin/bash
# Run the following command to uninstall all conflicting packages:
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install 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
# Add the repository to Apt sources:
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
# To install the latest version, run:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
echo 'Docker successfully installed.'
@welel
Copy link
Author

welel commented Nov 4, 2023

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