Docker is a popular platform for containerizing applications. This guide will show you how to install Docker on Ubuntu and prepare the system for working with containers.
Step 1: Update the system
sudo apt update
sudo apt upgrade -y
Step 2: Install dependencies
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
Step 3: Add the official Docker repository
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
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
Step 4: Install Docker
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io -y
Step 5: Check the installation
sudo systemctl status docker
docker --version
Step 6: Configure the user
sudo usermod -aG docker $USER
newgrp docker
Conclusion
After completing these steps, Docker is ready to use on Ubuntu. You can run containers, create images, and use Docker Compose to manage services.