HOW TO INSTALL DOCKER IN UBUNTU Ubuntu 22.04 LTS


Method 1: Docker Repository (Recommended)

Set up the repository: Configure your system to trust Docker's packages.
sudo apt-get update 
sudo apt-get install ca-certificates curl 
sudo install -m 0755 -d /etc/apt/keyrings 
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc 
sudo chmod a+r /etc/apt/keyrings/docker.asc




Add the repository:
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null




Install Docker Compose:
sudo apt-get update 
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin




Verify Installation:
docker compose version


Method 2: Ubuntu Repository (Stable)

For Ubuntu 24.04 and later, you can install the integrated package directly from the Ubuntu repositories. This installs Docker Engine and Compose V2 together. sudo apt update sudo apt install docker-compose-v2


Method 3: Manual Binary Installation

If you prefer not to add a repository, you can download the binary directly from GitHub. 
sudo curl -SL "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-compose docker-compose --version



Note: If you installed Docker but cannot run commands without sudo, add your user to the docker group: 
sudo usermod -aG docker $USER and then run newgrp docker.

Comments

Popular posts from this blog

Fixing Git Portable SSL Certificate Errors on Windows

Installing VM Ware Workstation required tools from build vmmon and vmnet