The CentOS7docker service could not start the solution and implementation steps

  • 2020-05-27 07:53:39
  • OfStack

The CentOS7 docker service could not start the solution

Check the steps

Launch docker service:


systemctl restart docker

An error will be reported at this time. Please take the following steps:

1. Find the type of error to report, or the description of the error to report.
2. Check the docker configuration file
3. Check disk space
4. Check port occupancy

Steps,

Check the error type and view the log:


journalctl -xe

Check the configuration file, the location of different operating systems is basically the same:


/etc/sysconfig/docker/

Or go directly to docker to run the application, and 1 will usually have the default path to the relevant configuration file

Check disk space:


df -h

Check port occupation:


netstat -anp

The instance

The error information 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/FAILURE
Dec 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.

Solutions:

As mentioned in the last article, the solution to simple violence is to clean up the /var/lib/docker directory and reset the Settings.

However, it is not clear why. The server is out of power today, the service is still reporting an error. Point 1: simple violence is not a good solution. Here is a new analysis of the first question:

You can see fatal msg "listen tcp 172.17.0.1:2376: bind: cannot requested address", which says that one port is bound, but this address and port cannot be assigned.

If you don't understand, don't blindly bind the port.

I haven't found the configuration of port 2376 bind in the directory /var/lib/docker for a long time. After thinking about it for a long time, I suddenly feel that it is the configuration file of the program launch. Finally, I found it in the directory /etc/sysconfig/docker. Well, this was previously bound to implement a function related to jenkins, and it's not a blind trick. Temporarily comment out the line set by bind and restart the service. ok ~

Thank you for reading, I hope to help you, thank you for your support of this site!


Related articles: