1. Install the necessary toolset
sudo yum install -y yum-utils
2. Install Docker official source
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
3. Update the yum cache
sudo yum makecache fast
4、sudo yum -y install docker-ce
If there is no error, go to the next step, if there is an error, see the error
Prompt conflicting software, delete the same software
Install it again with sudo yum -y install docker-ce
Installation was successful
5. Start the Docker background service
sudo systemctl start docker
If the startup fails, the error message is as follows:
Whether it is sudo systemctl start docker.service to restart the service or something fails, Baidu has been fruitless for a long time, and the final effort pays off.
Solution:
1) Delete all files in sudo rm -rf /var/lib/docker/
2) Delete the docker.sock file under /var/run/ sudo rm -rf docker.sock
3) Enter sudo vim /etc/docker/daemon.json to change the json format
4) Save and exit
5) Restart the service sudo systemctl start docker.service
you're done
6. Test Docker
sudo docker run hello-world