Docker is a platform for developing, shipping, and running applications in containers. This guide covers installing Docker on different operating systems.
Install
Ubuntu and Debian
Follow these steps to install Docker on Ubuntu or Debian-based distributions:
Update the apt package index and install packages to allow apt to use a repository over HTTPS:
sudo apt-get update sudo apt-get install -y \ apt-transport-https \ ca-certificates \ curl \ gnupg \ lsb-release
Add Docker's official GPG key:
sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
Set up the repository:
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Update the apt package index and install Docker:
sudo apt-get update sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Add your user to the docker group to run Docker commands without sudo:
sudo usermod -aG docker $USER
Note
Log out and back in for this change to take effect.
Verify the installation:
docker --version docker run hello-world
CentOS/RHEL
Install required packages:
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Add the Docker repository:
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Install Docker:
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Start and enable Docker:
sudo systemctl start docker sudo systemctl enable docker
Add your user to the docker group:
sudo usermod -aG docker $USER
Verify the installation:
docker --version docker run hello-world
Troubleshooting
Common Issues
Repository does not have a Release file
If you encounter an error about missing Release files on Debian-based systems:
- Check that the correct distribution name is used in the repository URL
- See Proxmox Docker Repository Troubleshooting for a specific example
Docker daemon not running
If you get "Cannot connect to the Docker daemon" errors:
- Check if the Docker service is running:
sudo systemctl status docker
- Start the service if needed:
sudo systemctl start docker
Permission denied
If you get "permission denied" errors:
- Make sure your user is in the docker group:
groups
- If not, add it and log out/in:
sudo usermod -aG docker $USER