如何修复“ exec用户进程没有引起这样的文件或目录”? [英] How to fix "exec user process caused no such file or directory"

查看:110
本文介绍了如何修复“ exec用户进程没有引起这样的文件或目录”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Dockerfile中使用 tini ,但出现错误。

I'm trying to use tini in my Dockerfile but I'm getting an error.

我使用了 tini 自述文件中的代码示例。

I used the code example from the tini readme file.

# ... code which builds /app/foo

# Add Tini
ENV TINI_VERSION v0.18.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]

# Run the program when the container starts
CMD ["/app/foo"]

我希望我的程序无需运行 PID = 1 但我却得到: standard_init_linux.go:207:exec用户进程导致没有这样的文件或目录

I expect my program to run without having PID=1 but instead I get: standard_init_linux.go:207: exec user process caused "no such file or directory"

编辑:

/ app / foo 在Dockerfile的开头创建。 / app / foo 没有问题。作为证明,如果我注释掉 ENTRYPOINT 行(或删除所有与 tini 相关的代码),我的 / app / foo 运行正常,除了它具有 PID = 1

/app/foo is created in the beginning of the Dockerfile. There is no problem with /app/foo. As proof of this, if I comment out the ENTRYPOINT line (or remove all the tini related code), my /app/foo runs fine except for the fact that it has PID=1

推荐答案

导致上述问题的另一个原因可能是调用了使用不可用Shell的脚本。例如,当脚本的第一行是

Another cause for the issue listed above can be that a script is called which uses an unavailable shell. For example, when the first line of the script is

#!/bin/bash

然后,这需要系统上的 bash 。将系统的 bash 更改为默认的 sh(ell)可以解决。因此,替换为

Then this requires bash on the system. Changing bash to the default sh(ell) for the system can be a solution. So, replace by

#!/bin/sh

这篇关于如何修复“ exec用户进程没有引起这样的文件或目录”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆