Installation
Ubuntu 22/24 APT
# Update existing packages 🔄
sudo apt update
Update only updates the package list, while upgrade installs new package versions.
It ensures your local package cache is up-to-date with the repositories.
# Install prerequisite packages for HTTPS access 🔒
sudo apt install apt-transport-https ca-certificates curl software-properties-common
# Add GPG key for the Docker repository 🔑
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# Add Docker repository to APT sources ⬇️
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
allow you to install Docker from Docker’s official repository instead of Ubuntu’s default repository.
# Update package list for the repository addition to take effect 🔄
sudo apt update
# Check Docker candidate version ⚙️
apt-cache policy docker-ce
# Install Docker 🐳
sudo apt install docker-ce
# Check Docker status 🚀
sudo systemctl status docker
# Check Docker Version 📋
docker --version
# Check Docker compose version
docker compose version
# Run a Test Application 🧪
sudo docker run hello-world
REDHAT DNF
Install the dnf-plugins-core package (which provides the commands to manage your DNF repositories) and set up the repository.
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
systemctl status
docker --version
docker run hello-world
CentOS 7 YUM
update packages
sudo yum update
sudo yum check-update
installing essential dependencies
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Add official Docker repository
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
install docker
sudo yum install docker-ce
sudo systemctl start docker
sudo systemctl enable docker
to manage docker without sudo add user to docker group
sudo usermod -aG docker <your_username>
Last updated