Server ManagementIntermediate12 min
How to Install Docker and Docker Compose
Complete guide to installing Docker and Docker Compose for containerized applications
Introduction
Docker allows you to package applications in containers. This guide covers installing Docker and Docker Compose.
Step 1: Update System Packages
Ensure your system is up to date before installation.
sudo apt update
sudo apt upgrade -yStep 2: Install Docker Dependencies
Install required packages for Docker installation.
sudo apt install apt-transport-https ca-certificates curl software-properties-commonStep 3: Add Docker Repository
Add the official Docker repository to your system.
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/nullStep 4: Install Docker
Install Docker Engine and related packages.
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.ioStep 5: Install Docker Compose
Download and install Docker Compose.
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-composeStep 6: Add User to Docker Group
Add your user to the docker group to run Docker without sudo.
sudo usermod -aG docker $USER
newgrp dockerConclusion
Docker and Docker Compose are now installed. You can start deploying containerized applications on your server.
#Docker#Containers#DevOps#Linux