为什么我的docker-entrypoint.sh无法执行?

我的ENTRYPOINT脚本无法执行并抛出 standard_init_linux.go:175: exec user process caused

"no such file or directory"。为什么这样?

不起作用

$ 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!'

作品

$ 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'"]

回答:

vault:latest图像不包含/bin/bash您尝试用shebang调用的图像#!/bin/bash。您应该将其更改为#!/bin/sh脚本,或者将其删除。

以上是 为什么我的docker-entrypoint.sh无法执行? 的全部内容, 来源链接: utcz.com/qa/436239.html

回到顶部