How to Install Docker on Debian

Docker is a powerful tool that helps developers run applications in containers. If you’re using Debian and want to get Docker up and running, this guide will show you the easiest way to do it.

What You’ll Need

  • A Debian system
  • Terminal access with sudo privileges
  • Internet connection

Installation Steps

Step 1: Update Your System

First, let’s make sure your system is up to date:

sudo apt-get update

Step 2: Install Required Packages

Install the packages needed for the Docker installation:

sudo apt-get install ca-certificates curl

Step 3: Add Docker’s Official Key

Create a directory for Docker’s key and download it:

sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

Step 4: Add Docker Repository

Add Docker’s repository to your system:

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

Update your package list:

sudo apt-get update

Step 5: Install Docker

Now install Docker and its components:

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

Step 6: Test Your Installation

Verify that Docker is working correctly:

sudo docker run hello-world

If everything is working, you’ll see a welcome message from Docker!

Important Notes

For Other Debian-Based Distros: If you’re using Kali Linux or another Debian derivative, you might need to replace $VERSION_CODENAME with the actual Debian codename like bookworm.

Running Without Sudo: Initially, you’ll need to use sudo with Docker commands. To run Docker without sudo, you can add your user to the docker group (we’ll cover this in a future post).

What’s Next?

Now that you have Docker installed, you can start:

  • Running your first containers
  • Building custom images
  • Setting up development environments
  • Exploring Docker Compose for multi-container applications

Troubleshooting

If you encounter any errors during installation:

  1. Make sure your system is fully updated
  2. Check that you have internet connectivity
  3. Verify you have sudo privileges
  4. Try running the commands one by one instead of all at once

Docker is now ready to use on your Debian system! In our next posts, we’ll explore how to use Docker effectively and share some useful tips and tricks.


Have questions about Docker installation? Leave a comment below and we’ll help you out!

Loading

Über chukfinley

I am a long time Linux user and FLOSS enthusiast. I use Debian with DWM. Furthermore, I know how to code in Python, Flutter, HTML (How to meet ladies). I also love minimalism.

Zeige alle Beiträge von chukfinley →

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert