Docker installation
Docker and Docker Compose installation guide
The following describes installing docker and docker-compose on Ubuntu 22.04, use the appropriate steps for your specific installation.
Docker Installation
Open a terminal and update the System:
sudo apt update && sudo apt upgrade
Remove any old version if installed:
sudo apt remove docker docker-engine docker.io containerd runc
Install the Docker dependencies:
sudo apt install ca-certificates curl gnupg lsb-release
Add the Docker's GPG Key:
sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
Set Up the Repository
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Update the Package Lists Again:
sudo apt update
Install Docker:
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Verify Installation:
sudo docker run hello-world
Docker Compose Installation
Run the following commands one after the other, do not close the session before completing all the steps outlined below.
Get the latest version tag:
VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep
'tag_name' | cut -d '"' -f 4)
Download Docker Compose:
sudo curl -L
"https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-$(uname
-s)-$(uname -m)" -o /usr/local/bin/docker-compose
Set execution permissions:
sudo chmod +x /usr/local/bin/docker-compose
Verify docker-compose works by running:
sudo docker-compose --version
Last updated