Docker Installation in Centos/RHEL
Method -1: 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
$Code language: JavaScript (javascript)
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
$
<strong># Docker is installed but not started. The docker group is created, but no users are added to the group.</strong>
Code language: PHP (php)
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
$
Method – 2: 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.rpmCode language: JavaScript (javascript)
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
Method – 3: 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
Code language: JavaScript (javascript)
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
Docker install in Ubuntu
How to Install Docker in RHEL8 / RHEL9 / CENTOS8 / CENTOS9?
# Update your system to ensure that you have the latest packages by running the command:
$ sudo dnf update
# Install the required dependencies:
$ sudo dnf install -y dnf-plugins-core
Add the Docker repository to your system by running the command:
$ sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
Install Docker by running the following command:
$ sudo dnf install -y docker-ce docker-ce-cli containerd.io --allowerasing
After the installation is complete, start the Docker service and enable it to start automatically at boot time:
$ sudo systemctl start docker
$ sudo systemctl enable docker
Verify that Docker is installed and working correctly by running the following command:
$ sudo docker run hello-worldCode language: PHP (php)
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at Cotocus. I share tech blog at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow , and SEO strategies at Wizbrand.
Do you want to learn Quantum Computing?
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at WIZBRAND
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services — all in one place.
Explore Hospitals
Nice and clear guide! The steps for Docker installation and configuration are explained really well, making it easier for beginners to set up Docker on their system. A helpful resource for anyone starting with containerization.