dockerdockerfile

Why won't my docker-entrypoint.sh execute?


My ENTRYPOINT script doesn't execute and throws standard_init_linux.go:175: exec user process caused "no such file or directory". Why so?

Doesn't Work

$ docker build -t gilani/trollo . && docker run gilani/trollo
Sending build context to Docker daemon   126 kB
Step 1 : FROM vault:latest
 ---> 1f127f53f8b5
Step 2 : MAINTAINER Amin Shah Gilani <gilani@payload.tech>
 ---> Using cache
 ---> 86b885ca1c81
Step 3 : COPY vaultConfig.json /vault/config
 ---> Using cache
 ---> 1a2be2fa3acd
Step 4 : COPY ./docker-entrypoint.sh /
 ---> Using cache
 ---> 0eb7c1c992f1
Step 5 : RUN chmod +x /docker-entrypoint.sh
 ---> Running in 251395c4790f
 ---> 46aa0fbc9637
Removing intermediate container 251395c4790f
Step 6 : ENTRYPOINT /docker-entrypoint.sh
 ---> Running in 7434f052178f
 ---> eca040859bfe
Removing intermediate container 7434f052178f
Successfully built eca040859bfe
standard_init_linux.go:175: exec user process caused "no such file or directory"

Dockerfile:

FROM vault:latest

MAINTAINER Amin Shah Gilani <gilani@payload.tech>

COPY vaultConfig.json /vault/config

COPY ./docker-entrypoint.sh /

RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT ["/docker-entrypoint.sh"]

docker-entrypoint.sh:

#!/bin/bash

echo 'Hello World!'

Works

$ docker build -t gilani/trollo . && docker run gilani/trollo
Sending build context to Docker daemon   126 kB
Step 1 : FROM vault:latest
 ---> 1f127f53f8b5
Step 2 : MAINTAINER Amin Shah Gilani <gilani@payload.tech>
 ---> Using cache
 ---> 86b885ca1c81
Step 3 : COPY vaultConfig.json /vault/config
 ---> Using cache
 ---> 1a2be2fa3acd
Step 4 : ENTRYPOINT echo 'hello world'
 ---> Using cache
 ---> ef5792a1f252
Successfully built ef5792a1f252
'hello world'

Dockerfile:

FROM vault:latest

MAINTAINER Amin Shah Gilani <gilani@payload.tech>

COPY vaultConfig.json /vault/config

ENTRYPOINT ["echo", "'hello world'"]

Solution

  • the vault:latest image does not contain /bin/bash which you try to call with your shebang #!/bin/bash. You should either change that to #!/bin/sh or completely remove the shebang from your script.