1

I was able to build a successful image out of the Dockerfile below but I failed to run the image and I get the error below even though I have copied the entrypoint.sh to the right location. Any pointers to fix this would be great.

Error: docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "docker-entrypoint.sh": executable file not found in $PATH: unknown.


ENV NODE_VERSION 12.22.6

COPY docker-entrypoint.sh /usr/local/bin/   
ENTRYPOINT ["docker-entrypoint.sh"]

CMD [ "node" ]

the docker-entrypoint.sh looks like below:

#!/bin/sh
set -e

if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ]; then
  set -- node "$@"
fi

exec "$@"
Avi
  • 1,453
  • 4
  • 18
  • 43
  • Can you reduce this example to a [mcve]? For example, is the list of GPG key IDs necessary to demonstrate the permission error? Have you verified that the entrypoint script is executable, has a correct `#!` "shebang" line at the beginning, and has Unix line endings if you're on a Windows host? – David Maze Oct 01 '21 at 18:22
  • Can you provide the value of $PATH? – mmoehrlein Oct 01 '21 at 18:25
  • @DavidMaze - I have edited the post now to add the entrypoint.sh and yes the "shebang" has been added as you can see. I'm using MacBookPro so I believe the line endings should be Unix readable. – Avi Oct 01 '21 at 22:18
  • @mmoehrlein - the value of $PATH is - /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin – Avi Oct 01 '21 at 22:25
  • 1
    Can you try making docker-entrypoint.sh executable? You can use ‘chmod +x FILENAME’ – jkr Oct 01 '21 at 22:58
  • The Dockerfile is invalid, it's missing a FROM line. – BMitch Oct 02 '21 at 12:50

1 Answers1

1

I've seen this before. Not sure how to fix it.

BUT, luckily, there is a 2nd format you can write that command in, for example:

ENTRYPOINT docker-entrypoint.sh node $TEST_VAR1 $TEST_VAR2
djangofan
  • 28,471
  • 61
  • 196
  • 289