Docker installation on Ubuntu
Here is a guide to install Docker on Ubuntu.
Install docker and its dependencies
The following packages are required to install Docker properly:
sudo apt-get install -y ca-certificates gnupg lsb-release
Add Docker repository
And the last command adds the Docker repository to the sources list.
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
Install Docker
Update the package index and install Docker:
sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
Verify the installation
Execute the following command to check the Docker version:
docker -v
You should see output similar to:
# Docker version 25.0.3, build 4debf41
Note
The docker version may vary depending on the latest release.
Permissions
allow usage of docker as non-root user
Create the docker group if doesn't exist:
sudo groupadd docker
Add user to docker group
sudo usermod -aG docker $USER
You have successfully installed Docker on Ubuntu. You can now start using Docker to create and manage containers on your system.
Install docker-compose and its dependencies
If you want to install Docker Compose, you can follow the instructions here.