Dockerd can't start as daemon with error "exec: "docker-containerd": executable file not found in $PATH"

Viewed 538

I can't start docker service -- docker 17.12.1 ce on sles12.4 --If anyone can show me what's wrong. It will be appreciated. I extracted docker-17.12.1-ce.tgz from download.docker.com and move all to /usr/bin/docker, then I added "/usr/bin/docker" to PATH -- docker:/tmp/installer # printenv|grep PATH ... PATH=/usr/bin/docker:/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games ... docker:/tmp/installer # ls /usr/bin/docker docker docker-containerd docker-containerd-ctr docker-containerd-shim docker-init docker-proxy docker-runc dockerd

 When I ran "dockered" manually, it looks all right. And then I edited /etc/systemd/system/docker.service -- 

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target

[Service]
Type=notify
ExecStart=/usr/bin/docker/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s

[Install]
WantedBy=multi-user.target

And the "systemctl start docker" failed to start docker as daemon. The "journalctl -xe" reported this error --

Jan 06 12:00:36 docker dockerd[8884]: time="2022-01-06T12:00:36.970600345-05:00" level=warning msg="[!] DON'T BIND ON ANY IP ADDRESS WITHOUT setting --tlsverify IF YOU DON'T KNOW WHAT YOU'R
Jan 06 12:00:36 docker dockerd[8884]: Failed to connect to containerd: exec: "docker-containerd": executable file not found in $PATH
Jan 06 12:00:36 docker systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Jan 06 12:00:36 docker systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed

But actually -- the "docker-containerd" IS in the $PATH... and I even copied it to /usr/bin, but still failed with same error. And I searched this -- https://stackoverflow.com/questions/54269687/getting-error-while-running-docker-run-error-response-from-daemon/56990533#56990533--

But it also can't fix this issue by "systemctl restart docker" I really don't know what's the problem. Please kind help. Thanks

Regards Eisen

1 Answers

Find the answer -- that path is not the user's environment variable -- PATH -- it's the system service's environment variable --PATH. So we need to

1. systemctl edit docker
2. edit the newly created /etc/systemd/system/docker.service.d/override.conf
    [Service]
    Environment="PATH=$PATH:/usr/bin/docker"

Then it would be OK.

Related