Open In App

Docker Installation in Linux With its Required Packages Using GPG Key

Last Updated : 30 Mar, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Pre-requisite: Docker

In this article, we are going to install docker using the GPG key, but why use GPG? because we don’t want to install unauthenticated packages to our Linux machine and risk our Linux machine and also to make sure users can communicate securely. GPG, or GNU Privacy Guard, is a public key cryptography implementation. This allows for the secure transmission of information between parties and can be used to verify that the origin of a message is genuine

Before installation make sure to login as a root –>command–>(su). if, the root password is not set, set using the command–>(sudo passwd root) also, make sure to enter a password greater than eight words.

Step 1:After login in as a root user, Retrieve and add the GPG Public Keys. Retrieve GPG key

wget https://download.docker.com/linux/ubuntu/gpg
Retrieve GPG key

 

Step 2: Adding GPG key.

apt-key add gpg
Adding GPG key

 

Step 3: Verify Key Fingerprint.

sudo apt-key fingerprint 0EBFCD88
Verify fingerprint

 

Step 4: Install the Required Packages.

Install required packages

 sudo apt install apt-transport-https 
 ca-certificates curl gnupg-agent 
software-properties-common
Installing required packages

 

Step 5: Add the Docker Repository to the Sources List.

Using --> gedit /etc/apt/sources.list
Add--> deb [arch=amd64] https://download.
docker.com/linux/ubuntu bionic stable
 

Adding docker repository to the source list

 

Source list

 

Step 6: Install Docker on Ubuntu

Initially update the packages in our ubuntu system.

Using -->sudo apt update
Updating current packages

 

Step 7: Now, install docker.

Using-->sudo apt install docker-ce
Installing docker

 

Step 8: Verify Docker Installation

Using-->systemctl status docker
Docker running status

 

Step 9: Execute Docker Commands without sudo. by, Adding a username to docker-group.

Using-->usermod -aG docker vikash
(in place of Vikash enter your ubuntu username)
Adding a user to the docker group

 

Step 10: Run a Docker Container.

1st — fetch the image.

Using-->docker pull hello-world
Pulling hello-world docker image

 

2nd– now, RUN the container.

Using-->docker run hello-world
Running hello-world docker image

 


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads