Skip to content

Instantly share code, notes, and snippets.

@opentaq
Last active April 20, 2024 21:57
Show Gist options
  • Save opentaq/1258ed1234423c2ae45312c50aadd36d to your computer and use it in GitHub Desktop.
Save opentaq/1258ed1234423c2ae45312c50aadd36d to your computer and use it in GitHub Desktop.

Installing Docker on Debian 11 (and Ubuntu)

Prerequisites

sudo apt update -y
sudo apt install ca-certificates curl gnupg lsb-release

Installing Docker GPG-Key

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Setting up the repository

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Installing Docker

sudo apt update 
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin

Create Docker group

sudo groupadd docker

Add current user to Docker group

sudo usermod -aG docker $USER

Install Docker Compose

curl -SL https://github.com/docker/compose/releases/download/v2.7.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose

Make Docker Compose executable

sudo chmod +x /usr/local/bin/docker-compose

Final step

Just log out and log in again. Then run

docker-compose -v
docker -v
docker ps

You should see 2x a version, and with the final statement, you should see an (empty) table.

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