Docker Installation in Linux With its Required Packages Using GPG Key
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
Â
Step 2: Adding GPG key.
apt-key add gpg
Â
Step 3: Verify Key Fingerprint.
sudo apt-key fingerprint 0EBFCD88
Â
Step 4: Install the Required Packages.
Install required packages
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
Â
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
Â
Â
Step 6: Install Docker on Ubuntu
Initially update the packages in our ubuntu system.
Using -->sudo apt update
Â
Step 7: Now, install docker.
Using-->sudo apt install docker-ce
Â
Step 8: Verify Docker Installation
Using-->systemctl status docker
Â
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)
Â
Step 10: Run a Docker Container.
1st — fetch the image.
Using-->docker pull hello-world
Â
2nd– now, RUN the container.
Using-->docker run hello-world
Â