Docker Installation in Centos 7 and Ubuntu

How to install docker in Centos 7 ?

To install the Docker in Centos, First we need to download the repository on the correct place ie.. “yum.repos.d” . Follow the below command to download Docker.

cd /etc/yum.repos.d/

yum install wget

wget https://download.docker.com/linux/centos/docker-ce.repo



Note:- If above is not working then first you need to install wget —

sudo yum install docker-ce docker-ce-cli containerd.io

 

 

How to install the docker in ubuntu ?

First add the GPG key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Now, Add Docker repository

sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”

Now update the repository

sudo apt-get update

Installing the docker from the docker repository

apt-cache policy docker-ce

Now, We are ready to install the docker

sudo apt-get install -y docker-ce

Below commands are common for both Centos and Ubuntu




After installation check the status of the Docker

sudo systemctl status docker

Enable the docker on system reboot
sudo systemctl enable docker

Start the Docker
sudo systemctl start docker

To find the help for docker

docker

How to find the images avaialable in dockerhub

docker search ubuntu

docker search nginx

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.