So, in our previous article, we have discussed about Docker, the technologies used in it and it’s working. In this article, we’ll check out how to install Docker CE on CentOS 7.
1) Docker is only supported on 64-bit architecture systems. So make sure you do not have a 32-bit system at hand.
Execute the following command to check the system architecture.
2) The centos-extras repository must be enabled.
This repository will be enabled by default on CentOS 7 Servers.
How to install Docker CE on CentOS 7
Before we begin, let’s update the package database of our Server:
yum update -y
You can install Docker CE in different ways:
Method 1 – Install using the repository (Recommended)
Install the required packages
yum install -y yum-utils device-mapper-persistent-data lvm2
Here, yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data and lvm2 are required by the devicemapper storage driver.
Setup the Docker repository
Use the command below to setup the repository for docker:
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Installing Docker CE
Install the latest version of Docker CE using the following command:
yum install docker-ce
Method 2 – Manually install by downloading the RPM
Downloading the RPM
Go to https://download.docker.com/linux/centos/7/x86_64/stable/Packages/ and download the .rpm file for the Docker version you want to install.
Installing Docker CE
Install the downloaded version of Docker CE using the following command:
yum install /path/to/package.rpm
That’s it. Docker is installed on your System.
Start/Stop Docker service
Start the docker service using:
systemctl start docker
To enable the Docker Service at boot time :
systemctl enable docker
To stop the docker service, do:
systemctl stop docker
Verify the Docker installation using any of the following commands:
Uninstalling Docker CE
Uninstall the Docker package by running:
yum remove docker-ce
Delete all images, containers, and volumes using:
rm -rf /var/lib/docker
That’s it!!! Any questions? Leave a comment below.