I just started using Docker for Windows and I quickly run into an error that I cannot resolve.
I have tried both the stable and beta releases with the same result.
standard_init_linux.go:175: exec user process caused "no such file or directory
This happens on e.g. the mongodb 3.2 Dockerfile on the hub. If I remove the ENTRYPOINT in that Dockerfile it will start.
The issue happens in other dockerfiles as well though. I believe it is related to ENTRYPOINT but I am not 100% certain.
I was facing the same issue and neither running dos2unix helped, neither was it a CRLF/LF based issue.
What I realized is that I was using a debian based image and to run the script, I had to use
ENTRYPOINT ["sh", "entrypoint.sh"]
So debian image had /bin/sh and not /bin/bash. Every shell has its own unique ways of running shell scripts and I learnt an important lesson to not assume that they all run the same.
Also, using an ubuntu:bionic image is much preferred. It defaults to bash.
So on the ubuntu:bionic image, both these work:
One way to also verify if your script is being executed correctly, is to have a simple echo "Hello world, this works!" command in your script and run the image locally.
docker run -it <image> /bin/bash for ubuntu. docker run -it <image> /bin/sh for debian.
If you see and output for the the echo command, things are working fine. Else, it should open up a shell in the root directory of the image.
I am using the debian:buster-slim image and it certainly has bash installed. Which debian were you using that didn’t have bash? Did you launch an interactive shell on the container and verify bash was not installed e.g. which bash ?
In your entrypoint.sh script, what was the she-bang at the top of the script?
I had this error when I erroneously used #!/usr/local/bin/bash
Changing the script to #!/bin/bash made it work.
I did try your suggestion of ENTRYPOINT[“bash”,“entrypoint.sh”] with the script still using the wrong she-bang, and that did also work. That kind of feels excessive though, you are launching a subshell to run your script which then runs in another subshell.