Docker: Error response from daemon: exec: "docker-init": executable file not found in $PATH

On attempting to create a docker container from a supplied image I see the following error.
Note: I had to condense or remove the unnecessary information as they relate to proprietary software.

siddy@dev1:~/may18$ docker run --init artifactory_url/image_dir/image:image_ver

docker: Error response from daemon: exec: “docker-init”: executable file not found in $PATH.

FYI -

siddy@dev1:~/may18$ docker version

Client: Docker Engine - Community
Version: 23.0.4
API version: 1.41 (downgraded from 1.42)
Go version: go1.19.8
Git commit: f480fb1
Built: Fri Apr 14 10:32:23 2023
OS/Arch: linux/amd64
Context: default

Server:
Engine:
Version: 20.10.24
API version: 1.41 (minimum version 1.12)
Go version: go1.20.3
Git commit: 5d6db84
Built: Mon Apr 10 09:55:49 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.6.20
GitCommit: 2806fc1057397dbaeefbea0e4e17bddfbd388f38
runc:
Version: 1.1.5
GitCommit:

siddy@dev1:~/may18$ echo $PATH

/home/siddy/.local/bin:/home/siddy/.nvm/versions/node/v10.24.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/bin/docker-init

1 Like

The error message is coming from the Docker daemon, which means that it is not enough for you to have it in the PATH in the docker client’s shell. The daemon needs that executable to copy into the container and use as an init process /usr/bin is usually already in the path for every user as you had too, but if the Docker daemon can’t find it then it seems the variable was somehow overridden for the daemon. Maybe in the systemd unit’s config or docker-init is not in that folder. What is your operating system and how did you install Docker exactly?

Please share links if you have.

Note: If you use the code block button </> instead of quoting the forum will not change the intentation and style of your shared code.

Ok.
1.) Ubuntu 20.04 LTS
2.) I believe I followed the steps mentioned here - How To Install and Use Docker on Ubuntu 18.04 | DigitalOcean.

Always use the official documentation first: Install Docker Engine on Ubuntu | Docker Docs
Not just in case of Docker but to install any software.

The steps described on Digital Ocean seem right, but I just took a quick look at it.

Have you checked the file on the host?

1 Like

I recently experienced the same thing. The docker-init binary wasn’t anywhere to be found on the host system. Reinstalling/Upgrading didn’t help. The one thing that helped was to chmod 755 /usr/libexec/docker/docker-init and that made it persist and then I was able to restart all my containers.