A Comprehensive Guide to Installing Docker CE on Various Linux Systems
Introduction: Docker, a powerful container runtime engine, allows developers to package applications with all their dependencies into standardized units for seamless software development. This guide focuses on installing Docker CE (Community Edition) on multiple Linux distributions, including Ubuntu, Debian, Fedora, Arch Linux, and CentOS.
1. Installing Docker CE on Ubuntu Linux:
A. Uninstalling Previous Docker Versions:
If you have an older version installed, remove it using the following commands:
sudo apt update
sudo apt remove docker docker-engine docker.io 2>/dev/null
B. Updating Apt Package Index:
sudo apt update
C. Installing Necessary Packages and Adding Docker’s GPG Key:
sudo apt -y install lsb-release gnupg apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/docker.gpg
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
D. Adding User to Docker Group (Optional for Non-Root Usage):
sudo usermod -aG docker $USER
newgrp docker
E. Checking Docker Version:
docker version
2. Installing Docker CE on Debian Linux:
A. Updating Apt Package Index:
sudo apt update
B. Installing Necessary Packages and Adding Docker’s GPG Key:
sudo apt install lsb-release gnupg2 apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/debian.gpg
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
C. Adding User to Docker Group (Optional for Non-Root Usage):
sudo usermod -aG docker $USER
newgrp docker
3. Installing Docker CE on Fedora Linux:
A.Uninstalling Older Docker Versions:
sudo dnf remove docker docker-common docker-selinux docker-engine-selinux docker-engine 2>/dev/null
B.Configuring Docker Repository:
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
C. Installing Docker CE:
sudo dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin
D. Starting and Enabling Docker Service:
sudo systemctl start docker && sudo systemctl enable docker
E. Adding User to Docker Group:
sudo usermod -aG docker $USER
newgrp docker
This comprehensive guide equips you with the knowledge to install Docker CE on various Linux distributions, enabling you to leverage the benefits of containerization for your development projects.