After the docker on the virtual machine is shut down, it can’t be started. The specific exception is as follows
At startup:
[root@localhost docker]# systemctl start docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
Follow the prompts
[root@localhost docker]# systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/etc/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2018-06-29 14:31:59 CST; 7s ago
Docs: http://docs.docker.com
Process: 2627 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --init-path=/usr/libexec/docker/docker-init-current --seccomp-profile=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=125)
Main PID: 2627 (code=exited, status=125)
Jun 29 14:31:59 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
Jun 29 14:31:59 localhost.localdomain dockerd-current[2627]: flag provided but not defined: --init-path
Jun 29 14:31:59 localhost.localdomain dockerd-current[2627]: See '/usr/bin/dockerd-current --help'.
Jun 29 14:31:59 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=125/n/a
Jun 29 14:31:59 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
Jun 29 14:31:59 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
Jun 29 14:31:59 localhost.localdomain systemd[1]: docker.service failed.
Execute journalctl – Xe to display more detailed exception:
--
-- Unit docker.service has begun starting up.
Jun 29 13:49:23 localhost.localdomain dockerd-current[5059]: flag provided but not defined: --init-path
Jun 29 13:49:23 localhost.localdomain dockerd-current[5059]: See '/usr/bin/dockerd-current --help'.
Jun 29 13:49:23 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=125/n/a
Jun 29 13:49:23 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.
--
-- The result is failed.
Jun 29 13:49:23 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
Jun 29 13:49:23 localhost.localdomain systemd[1]: docker.service failed.
Jun 29 13:49:23 localhost.localdomain polkitd[634]: Unregistered Authentication Agent for unix-process:5014:423047 (system bus name :1.40, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
Jun 29 13:52:05 localhost.localdomain polkitd[634]: Registered Authentication Agent for unix-process:5079:439186 (system bus name :1.41 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
Jun 29 13:52:05 localhost.localdomain systemd[1]: Starting Docker Storage Setup...
-- Subject: Unit docker-storage-setup.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
...........
...........
Here is the exception information. If the error code displayed during the execution of systemctl status docker.service is 125, please continue to look down. Only one same error is found on stack overflow, and it has not been solved.
After several hours, all kinds of schemes on the Internet failed. In the end, I focused on the following two main information points:
1、Process: 2533 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --init-path=/usr/libexec/docker/docker-init-current --seccomp-profile=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=125)
2、flag provided but not defined: --init-path
The information given here is that init path is not defined. Secondly, the first information lists a series of startup dependencies. It is obvious that there is something wrong with the configuration of my local environment. So my starting point is to copy the corresponding files from an OK node
/Usr/bin/docked current/usr/libexec/docker/docker runc current/usr/libexec/docker/docker proxy current/usr/libexec/docker/docker init current/etc/docker/seccomp.json. After copying to the corresponding directory, docker starts normally.
If not, synchronize the contents of/etc/SYSTEMd/system/docker. Service
during this period, you may need to execute systemctl daemon reload first, and then systemctl restart docker.service.
For some solutions mentioned on the Internet, if some files cannot be found, such as docker.sock, you can execute sudo docker daemon – D.
In addition, we should pay special attention to the fact that many schemes delete the folder/var/lib/docker/but my suggestion is never to do so, otherwise your containers will be destroyed. If you can’t, you can back it up first, and then replace it.