Docker Installation on Linux (Ubuntu)
Installation of Docker Desktop
Open Docker Docs on browser.
Now click on the
Download .deb
button.
Installation of Docker Engine
- First we will remove all the remove all the conflicting and broken packages if previously present.
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
- Now we will install the
docker dependencies
.
sudo apt update
First we will add the Docker GPG key.
- This command install the essential packages for the docker installation.
sudo apt-get install ca-certificates curl gnupg
- This command creates the directory
/etc/apt/keyrings
with the permissions0755
using the install command with superuser privileges.
sudo install -m 0755 -d /etc/apt/keyrings
- This command downloads a security key for Docker, converts it to a usable format, and saves it in a specific directory for package management on a Linux system.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
- This command gives the permission to access the key.
sudo chmod a+r /etc/apt/keyrings/docker.gpg
- This command adds the Docker repository to the system’s
apt
sources.
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- After this do the
apt update
to update the package list.
sudo apt-get update
Installation of Docker Desktop
- Now locate the docker desktop package (.deb) and install it.
sudo apt install ./docker-desktop-4.26.1-amd64.deb
Docker sign in (for Docker Hub as well as Docker Desktop)
Note: This sign-in is not directly possible as we need to generate a token from the docker hub and then use that token to sign in to the docker desktop.
This is very important as its required to pull the images from the docker hub and also to push the images to the docker hub.
This command will generate the gpg key.
gpg --generate-key
Now pass the Name , Email and Passphrase.
- Now we will pass the
public generated key
from the previous command.
pass init <your_generated_gpg-id_public_key>
Now go to the Docker Desktop and do the sign in.
Thus we have successfully installed the docker desktop on our system.
Subscribe to my newsletter
Read articles from Rohit Rajput directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Rohit Rajput
Rohit Rajput
I'm Rohit Rajput, a final year Electronics and Communication Engineering student at UIET, Punjab University. I'm deeply engaged in DevOps, harmonizing cutting-edge tech with agile development and deployment practices.