Reputation: 3745
I'm new to Docker, and am trying a simple example of an Ubuntu container that runs a shell script. I'm on Windows 10 with Docker 17.09.0-ce.
My shell script is simply:
#!/bin/sh
echo "hello world!"
My Dockerfile is:
FROM ubuntu:14.04
WORKDIR /usr/local/bin
COPY shelltest.sh shelltest.sh
ENTRYPOINT ["/usr/local/bin/shelltest.sh"]
I've tried various forms of ENTRYPOINT and CMD invocations, and none work. They all fail with "no such file or directory". When I change the entry point to "/bin/sh" and launch the container interactively, I can see the file /usr/local/bin/shelltest.sh, and it has execute permissions 755, so I'm at a loss to explain why this isn't working. Here's what the file looks like in the container when the entry point is set to "ls -l /usr/local/bin/shelltest.sh":
ENTRYPOINT ["ls", "-l", "/usr/local/bin/shelltest.sh"]
d:\Dev\Docker\shelltest>docker run shelltest
-rwxr-xr-x 1 root root 32 Oct 29 16:32 /usr/local/bin/shelltest.sh
What am I missing?
Here are some things I've tried:
ENTRYPOINT ["/usr/local/bin/shelltest.sh"]
d:\Dev\Docker\shelltest>docker run shelltest
standard_init_linux.go:185: exec user process caused "no such file or directory"
ENTRYPOINT ["shelltest.sh"]
d:\Dev\Docker\shelltest>docker run shelltest
standard_init_linux.go:185: exec user process caused "no such file or directory"
CMD ["/usr/local/bin/shelltest.sh"]
d:\Dev\Docker\shelltest>docker run shelltest
standard_init_linux.go:185: exec user process caused "no such file or directory"
Upvotes: 4
Views: 1192