Doker does not start properly: Failed to start Docker Application Container Engine

Keywords: Docker Attribute Ruby JSON

The docker on the virtual machine can't start when it shuts down. The specific abnormalities are as follows.

Startup time:

[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 tips

[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 exceptions:

-- 
-- 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
...........
...........

If the error code displayed when executing system CTL status docker. service is 125, please continue to look down. The whole network only searches for the same error in Stack Overflow, and he has not solved it yet.

After several hours of working on various schemes on the Internet, I finally put the main information points into the following two:

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. The first information lists a series of startup dependencies. Obviously, these environments of my machine are out of order now, so my starting point is to copy the corresponding files from an OK node.

  • /usr/bin/dockerd-current
  • /usr/libexec/docker/docker-runc-current
  • /usr/libexec/docker/docker-proxy-current
  • /usr/libexec/docker/docker-init-current
  • /etc/docker/seccomp.json

    That's all. After copying to the corresponding directory, the docker starts up normally.

If not, synchronize the contents of the file / etc/systemd/system/docker.service.
During this period, you may first execute system CTL daemon-reload and then system CTL restart docker. service.

Some solutions mentioned on the internet, such as sudo docker daemon-D, can be executed if some files are not found, such as docker.sock, etc.

Another point to note is that many schemes say to delete / var/lib/docker / this folder, but my advice is never to do so, or your container will be destroyed. If you can't, you can backup it and replace it.

Posted by nezbo on Tue, 08 Jan 2019 15:51:10 -0800