Docker is a popular container platform software. In this post we are sharing the quick and easy way to install Docker on CentOS 7. We are using here Docker Engine Community edition which is free to use. The method of installing Docker is via repository which is also one of the recommended method.
Install prerequisites
Install prerequisites by using yum command.
yum install -y yum-utils device-mapper-persistent-data lvm2
Add Docker yum repo
Run the given below command to add the docker yum repo file. It will be created in /etc/yum.repos.d/
location in system.
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Install Docker by yum
The given below command will install the latest Docker version.
yum install -y docker-ce docker-ce-cli containerd.io
Start/Enable Docker Service
Start the docker service by running this command.
systemctl start docker
To enable docker service on every system boot/reboot.
systemctl enable docker
Restart/Stop/status/Disable of Docker Service
Restart the docker service by running this command.
systemctl restart docker
To stop the docker service.
systemctl stop docker
To check status of docker service.
systemctl status docker
Disable docker service so that it should not start when system boot/reboot.
systemctl enable docker