Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Debian 12 - Install Docker

Related Posts


Run the following script to install docker on Debian 12.


# Update the apt package index and install packages to allow apt to use a repository over HTTPS
sudo apt update

sudo apt install -y \
  apt-transport-https \
  ca-certificates \
  curl \
  gnupg-agent \

# Add Docker's official GPG key and add read permission to everyone.
sudo curl -fsSL | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add a the docker repository by creating a docker.list file in /etc/apt/sources.list.d directory
echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# Install docker  with the docker compose and the buildx plugin.
# More info on buildx here:
sudo apt update && \
  sudo apt install -y docker-ce docker-ce-cli docker-buildx-plugin docker-compose-plugin

# Add yourself to the docker group so you can run docker commands
# without sudo
sudo adduser $USER docker

At the time of writing this post, this resulted in installing Docker version 24.0.2.


Last updated: 20th October 2023
First published: 26th June 2023