Docker simplifies application containerization. Here's how to install Docker on Ubuntu:
-
Update the package index:
sudo apt update sudo apt upgrade -y
-
Install dependencies:
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
-
Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg -
Set up the Docker repository:
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
-
Install Docker:
sudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io
-
Verify the installation:
docker --version
-
Enable Docker to start on boot:
sudo systemctl enable docker -
Run Docker without sudo (optional):
sudo usermod -aG docker $USER newgrp docker