How to Install Community Edition (CE) in Centos/RHEL?

Prerequisites

  1. To install Docker CE, you need a maintained version of CentOS 7. Archived versions aren’t supported or tested.
  2. The centos-extras repository must be enabled. This repository is enabled by default, but if you have disabled it, you need to re-enable it.
  3. The overlay2 storage driver is recommended.

Uninstall old versions

Older versions of Docker were called docker or docker-engine. If these are installed, uninstall them, along with associated dependencies.


$ sudo yum remove docker 
$ sudo yum remove docker docker-client 
$ sudo yum remove docker docker-client-latest 
$ sudo yum remove docker docker-common
$ sudo yum remove docker docker-latest 
$ sudo yum remove docker docker-latest-logrotate
$ sudo yum remove docker docker-logrotate 
$ sudo yum remove docker docker-selinux 
$ sudo yum remove docker docker-engine-selinux
$ sudo yum remove docker docker-engine

It’s OK if yum reports that none of these packages are installed. The contents of /var/lib/docker/, including images, containers, volumes, and networks, are preserved.

How to install Docker Community Edition via YUM?

Step 1 - Install required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data and lvm2 are required by the devicemapper storage driver.
$ sudo -s
$ 
$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Step 2 - Use the following command to set up the stable repository
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Step 3 - Install the latest version of Docker CE
$ sudo yum install –y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ sudo yum-config-manager --enable rhui-REGION-rhel-server-extras
$ sudo yum install -y docker-ce
$ sudo yum install docker-ce
# Verify Docker Installations
$ docker -v

# Docker is installed but not started. The docker group is created, but no users are added to the group.
Step 4 - Enable Docker
$ sudo systemctl enable docker
Step 5 - Start Docker
$ sudo systemctl start docker
$ docker info
Step 5 - Verify that docker is installed correctly by running the hello-world image.
$ sudo docker run hello-world

How to install Docker Community Edition via RPM Packages?

Step 1 - Go to HERE(https://download.docker.com/linux/centos/7/x86_64/stable/Packages/) and Copy the url of Latest Packages.
$ sudo yum install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-18.03.0.ce-1.el7.centos.x86_64.rpm
Step 2 - Enable Docker
$ sudo systemctl enable docker
Step 3 - Start Docker
$ sudo systemctl start docker
Step 4 - Verify that docker is installed correctly by running the hello-world image.
$ sudo docker run hello-world

How to install Docker Community Edition via script?

Docker provides convenience scripts at get.docker.com.
Step 1 - Download and Run the script.
$ curl -fsSL get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
Step 2 - Enable Docker
$ sudo systemctl enable docker
Step 3 - Start Docker
$ sudo systemctl start docker
Step 4 - Verify that docker is installed correctly by running the hello-world image.
$ sudo docker run hello-world

  Call us on +91 700 483 5930   |   +91 700 483 5706     Contact@DevopsSchool.com