我有一个 super 愚蠢的脚本
$ cat script.sh
cat <<EOT > entrypoint.sh
#!/bin/bash
echo "$@"
EOT
docker run -it --rm -v $(pwd)/entrypoint.sh:/root/entrypoint.sh --entrypoint /root/entrypoint.sh bash:4 Hello World
但是当我运行脚本时,我得到了奇怪的错误:
$ sh script.sh
standard_init_linux.go:207: exec user process caused "no such file or directory"
为什么脚本不打印
Hello world
?
最佳答案
standard_init_linux.go:207: exec user process caused "no such file or directory"
上述错误意味着以下之一:
/bin/sh
反而。这是我看到的最常见的问题。 \r
尝试运行的命令的名称,在 linux 端找不到。 这个列表来自我在去年的 DockerCon 上的演讲:https://sudo-bmitch.github.io/presentations/dc2018/faq-stackoverflow.html#59
关于bash - 将参数正确传递给 docker 入口点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55173731/