入口点只是拒绝执行甚至壳运行

发布于 2025-01-20 12:07:45 字数 1734 浏览 4 评论 0原文

这是我自周末以来焦头烂额的第三天,我只是无法通过 gitlab runner 13.3.1 让 ENTRYPOINT 工作,这是以前使用简单的 ENTRYPOINT [“/bin/bash”] 工作的东西,但是那是使用本地 docker 桌面并使用 docker run 和 docker exec 命令,其工作方式类似于同步。本质上,最后我之前构建了一个 WAR 文件。

目前,我在 gitlab runner 13.3.1 中构建容器并推送到 s3 存储桶,然后使用 IMAGE:localhost:500/my-recently-builtcontainer ,然后尝试对容器执行我想要的任何操作,但我什至无法获取 ENTRYPOINT工作,以它的 exec 形式或 shell 形式 - 至少在 shell 形式中我可以看到一些东西。在 exec 形式中,它只是给出了“OCI 运行时创建失败”的不透明错误,因此我转向 shell 形式只是为了看看我能到达哪里。

我不断

sh: 1: sh: echo HOME=/home/nonroot-user params=@$ pwd=/ whoami=nonroot-user script=sh ENTRYPOINT reached which_sh=/bin/sh which_bash=/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin; ls -alrth /bin/bash; ls -alrth /bin/sh; /usr/local/bin/entrypoint.sh ;: not found

在我的 Dockerfile 中得到明显的

COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN bash -c "ls -larth /usr/local/bin/entrypoint.sh"

ENTRYPOINT "echo HOME=${HOME} params=@$ pwd=`pwd` whoami=`whoami` script=${0} ENTRYPOINT reached which_sh=`which sh` which_bash=`which bash` PATH=${PATH}; ls -alrth `which bash`; ls -alrth `which sh`; /usr/local/bin/lse-entrypoint.sh ;"

结果 在 gitlab 中构建容器后的输出是 - 并且我确保任何人都有权查看此文件并使用它 - 这样我就可以继续我的工作

-rwxrwxrwx 1 root root 512 Apr 11 17:40 /usr/local/bin/entrypoint.sh

所以,我知道它就在那里,所有 chmod 标志都表明任何人都可以查看它 - 所以我是如此困惑为什么它说 NOT FOUND

/usr/local/bin/entrypoint.sh ;: not found

entrypoint.sh is ...

#!/bin/sh
export PATH=$PATH:/usr/local/bin/

clear
echo Script is $0
echo numOfArgs is $#
echo paramtrsPassd is $@
echo whoami is `whoami`

bash --version
echo "About to exec ....."
exec "$@"

它甚至没有到达这个entrypoint.sh 文件内部。

This is my 3rd day of tear-your-hair-out since the weekend and I just cannot get ENTRYPOINT to work via gitlab runner 13.3.1, this for something that previously worked with a simple ENTRYPOINT ["/bin/bash"] but that was using local docker desktop and using docker run followed by docker exec commands which worked like a synch. Essentially, at the end of it all I previously got a WAR file built.

Currently I build my container in gitlab runner 13.3.1 and push to s3 bucket and then use the IMAGE:localhost:500/my-recently-builtcontainer and then try and do whatever it is I want with the container but I cannot even get ENTRYPOINT to work, in it's exec form or in shell form - atleast in the shell form I get to see something. In the exec form it just gave "OCI runtime create failed" opaque errors so I shifted to the shell form just to see where I could get to.

I keep getting

sh: 1: sh: echo HOME=/home/nonroot-user params=@$ pwd=/ whoami=nonroot-user script=sh ENTRYPOINT reached which_sh=/bin/sh which_bash=/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin; ls -alrth /bin/bash; ls -alrth /bin/sh; /usr/local/bin/entrypoint.sh ;: not found

In my Dockerfile I distinctly have

COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN bash -c "ls -larth /usr/local/bin/entrypoint.sh"

ENTRYPOINT "echo HOME=${HOME} params=@$ pwd=`pwd` whoami=`whoami` script=${0} ENTRYPOINT reached which_sh=`which sh` which_bash=`which bash` PATH=${PATH}; ls -alrth `which bash`; ls -alrth `which sh`; /usr/local/bin/lse-entrypoint.sh ;"

The output after I build the container in gitlab is - and I made sure anyone has rights to see this file and use it - just so that I can proceed with my work

-rwxrwxrwx 1 root root 512 Apr 11 17:40 /usr/local/bin/entrypoint.sh

So, I know it is there and all the chmod flags indicate anybody can look at it - so I am so perplexed why it is saying NOT FOUND

/usr/local/bin/entrypoint.sh ;: not found

entrypoint.sh is ...

#!/bin/sh
export PATH=$PATH:/usr/local/bin/

clear
echo Script is $0
echo numOfArgs is $#
echo paramtrsPassd is $@
echo whoami is `whoami`

bash --version
echo "About to exec ....."
exec "$@"

It does not even reach inside this entrypoint.sh file.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文