Before enabling any repositories , we should be sure that we have installed the necessary required packages to support Docker.
- yum install -y yum-utils device-mapper-persistent-data lvm2
Next using appropriate command add the docker CE repository also update the local yum cache once added
- yum-config-manager –add-repo https://download.docker.com/linux/centos/docker-ce.repo
Next use the appropriate command to install Docker CE application from the new-configured repository.
- sudo yum install docker-ce
- Once Docker installed properly it should show below message
- Using the appropriate service management commands we need to enable Docker CE service so that it gets starts by itself while the service reboots and then start the Dokcer CE service.
Command:- systemctl enable docker && systemctl start docker && systemctl status docker
- Command to start docker service:- systemctl start docker
- Command to stop docker service:- systemctl stop docker
- Command to status docker service:- systemctl status docker
- To test the docker service we can pull a dummy image can use below command to pull and image
command:- docker pull httpd
- As we have pulled the httpd image so if we execute the command docker images it should show the image name
Command:- docker images