【问题标题】:How to resolve timeout: can't execute '/bin/bash': No such file or directory error?如何解决 timeout: can\'t execute \'/bin/bash\': No such file or directory 错误?
【发布时间】:2022-11-25 02:21:27
【问题描述】:

我正在 .gitlab-ci.yml 中编写一个 yaml 锚点,如下所示:

.docker_daemon_to_start: &docker_daemon_to_start
    - timeout 300 /bin/bash -c -- 'while ! docker info; do sleep 1; done'

在上面的命令中,我尝试了 /bin/bash/usr/bin/bash,但是管道给出了一个错误,

timeout: can't execute '/bin/bash': No such file or directory

是否有任何修复此错误以使管道处于运行状态的方法?

【问题讨论】:

  • 您可以添加您的 docker 文件或 docker compose yml 吗?您为您的 docker 容器使用什么图像?
  • 如果您使用的是图像的最低版本,如alpine,则其中没有 bash shell。
  • @DreamBold 是的,我正在使用高山图像“node:16-alpine3.16”。解决方案是什么?
  • 只需更改它node:16 即可

标签: bash docker gitlab timeout


【解决方案1】:

如果您使用的是图像的最低版本,例如 alpine,则其中没有 bash shell。只需将其更改为node:16,bash 即可运行。

【讨论】:

    猜你喜欢
    • 2022-10-16
    • 2014-12-02
    • 1970-01-01
    • 1970-01-01
    • 2020-02-14
    • 2016-11-01
    • 1970-01-01
    • 2018-06-07
    • 2018-05-19
    相关资源
    最近更新 更多