1. Update Software Packages#
Run the command sudo apt update
to update the apt software package index, and then run sudo apt upgrade
to update the installed software packages.
2. Install Docker#
Copy and paste the following commands directly into the terminal console and press Enter to submit:
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
After installation, the Docker daemon will start and automatically start on system reboot.
3. Install Docker Compose#
Run the following command to install Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/download/$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
4. Installation Complete#
Now your Debian 11 server has Docker and Docker Compose installed.
You can verify the installation by running the commands docker -v
and docker-compose --version
.