Skip to content

Installing Docker on Debian-based distros

These instructions will guide you through the process of installing Docker on Debian based systems (Debian, Ubuntu, Linux Mint, Raspberry Pi OS, etc.).
Follow the steps to install Docker and configure it to run without sudo.

Installation

Update your system

sudo apt update
sudo apt upgrade -y

Install Docker

The easiest way to install Docker is via the official convenience script:

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

Verify Docker Installation

Verify Docker has been successfully installed by running:

sudo docker run hello-world

Configuration

Configure Docker to Run Without sudo

To run Docker without using sudo, add your user to the Docker group:

sudo usermod -aG docker $USER

After this, log out and log back in (or reboot) for the group change to take effect.

Now you should be able to run Docker commands without sudo:

docker --version
docker compose version

Troubleshooting

If you still encounter permission issues, make sure:

  • Your user is in the docker group by running groups.
  • Docker is running properly by checking its status: sudo systemctl status docker.
  • The Docker socket has the correct permissions:
    sudo chown root:docker /var/run/docker.sock
    sudo chmod 660 /var/run/docker.sock
    

After following these steps, Docker should be fully functional on your Linux Mint 21.3 system without needing sudo.

Removing Docker

If you want to remove Docker from your system do the following:

Stop Docker

sudo systemctl stop docker
sudo apt-get purge -y docker-ce docker-ce-cli containerd.io

Remove Docker directories

This will delete Docker’s storage directories, which contain images, containers, and volumes. Make sure to back up any important data before running this command.

sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd