Solve the general check that the docker service cannot be started under CentOS7
Check Procedure
Start the docker service:
Systemctl restart docker
An error is reported at this time. perform the following steps:
1. Locate the error type or description.
2. Check the docker configuration file.
3. Check disk space
4. Check port usage
Detailed steps
Check the error type and view the log:
journalctl -xe
Check the configuration file. The locations of different operating systems are basically the same:
/etc/sysconfig/docker/
Or you can directly find the docker running program, which usually has the default path of the relevant configuration file.
Check disk space:
df -h
Check port usage:
netstat -anp
Instance
The error message is as follows:
-- Unit docker.service has begun starting up.Dec 04 21:17:46 localhost.localdomain docker[7175]: time="2016-12-04T21:17:46.093155159+08:00" level=warning msg="/!\\ DON'T BIND ON ANY IP ADDRESS WITHOUT setting -tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING /!\\"Dec 04 21:17:46 localhost.localdomain docker[7175]: time="2016-12-04T21:17:46.093322868+08:00" level=fatal msg="listen tcp 172.17.0.1:2376: bind: cannot assign requested address"Dec 04 21:17:46 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILUREDec 04 21:17:46 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.-- Subject: Unit docker.service has failed-- Defined-By: systemd-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel-- -- Unit docker.service has failed.
Solution:
As mentioned in the previous article, the simple and violent solution is to clear the/var/lib/docker directory and reset the settings. However, the specific reasons are unclear. If the server is powered off today, the service still reports an error. It is explained that simple and violent means are not a good solution, and they are not a cure. The problem is analyzed again here:
We can see that fatal msg"Listen tcp 172.17.0.1: 2376: bind: cannot assign requested address ", which means that a port is bound, but the address and port cannot be allocated.
The previous line"If you don't understand it, Don't blindly bind the port ", quit ..
After searching for a long time, I did not find the bind configuration for port 2376 in the/var/lib/docker directory. After thinking for half a day, I suddenly felt that it was the configuration file for program startup, finally, it is found in the/etc/sysconfig/docker directory. Yes, this was previously bound to implement a jenkins-related function, not the blind state. TemporarilyComment out the line set by bind and restart the service. OK ~