Frequently Asked Question
Installing Docker on Linux
Last Updated 4 days ago
Installing Docker on Linux
Installing Docker on RHEL-Based Distributions
To install Docker on Red Hat Enterprise Linux (RHEL) and its variants, such as CentOS or Fedora, follow these steps:
sudo dnf install -y dnf-plugins-core
- Install the Required Package Manager Plugin:
sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
- Add the Docker Repository:
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- Install Docker CE and Related Packages:
sudo systemctl enable --now docker
- Start the Docker Service and Enable It to Start on Boot:
sudo usermod -aG docker $USER
- Add Your User to the Docker Group:
Installing Docker on Debian-Based Distributions
To install Docker on Debian-based distributions, such as Ubuntu or Linux Mint, follow these steps:
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release
- Update and Install Required Packages:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
- Add Docker’s Official GPG Key to Your Package Management System:
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
- Add the Docker Repository:
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
- Update the Package Index and Install Docker:
sudo systemctl enable --now docker
- Start the Docker Service and Enable It to Start on Boot:
sudo usermod -aG docker $USER
- Add Your User to the Docker Group (Optional):
Troubleshooting Tips
- Ensure that your system is up-to-date before installing Docker.
- Verify if your distribution is supported by checking the official Docker documentation.
- If you encounter permission issues, log out and back in after adding yourself to the
dockergroup.
By following these steps, you should be able to install and configure Docker on both RHEL-based and Debian-based distributions.
