当前位置: 首页 > 面试题库 >

Docker:命令返回了非零代码:137

邵伟泽
2023-03-14
问题内容

我的docker文件如下:

#Use python 3.6 image
FROM python:3.6
ENV PYTHONUNBUFFERED 1

#install required packages
RUN apt-get update
RUN apt-get install libsasl2-dev libldap2-dev libssl-dev python3-dev psmisc -y

#install a pip package
#Note: This pip package has a completely configured django project in it
RUN pip install <pip-package>

#Run a script
#Note: Here appmanage.py is a file inside the pip installed location(site-packages), but it will be accessible directly without cd to the folder
RUN appmanage.py appconfig appadd.json

#The <pip-packge> installed comes with a built in django package, so running it with following CMD
#Note: Here manage.py is present inside the pip package folder but it is accesible directly
CMD ["manage.py","runserver","0.0.0.0:8000"]

当我跑步时:

sudo docker build -t test-app .

dockerfile中的步骤,直到:RUN appmanage.py appconfig按预期成功运行,但是之后我得到了错误:

The command '/bin/sh -c appmanage.py appconfig ' returned a non-zero code: 137

当我用谷歌搜索错误时,我得到诸如内存不足的建议。但是我已经证实,系统(中心)有足够的内存。

执行期间的命令行输出RUN appmanage.py appconfig为:

Step 7/8 : RUN appmanage.py appconfig
 ---> Running in 23cffaacc81f

======================================================================================
configuring katana apps...
 Please do not quit (or) kill the server manually, wait until the server closes itself...!
======================================================================================
Performing system checks...

System check identified no issues (0 silenced).
February 08, 2020 - 12:01:45
Django version 2.1.2, using settings 'katana.wui.settings'
Starting development server at http://127.0.0.1:9999/
Quit the server with CONTROL-C.
9999/tcp:
    20Killed

问题答案:

如前所述,该命令RUN appmanage.py appconfig appAdd.json按预期成功运行并报告System check identified no issues (0 silenced).

此外,命令“坚持执行”杀死自己并返回退出代码137。此操作的最小更改是将您更新Dockerfile

...
#Run a script
#Note: Here appmanage.py is a file inside the pip installed location(site-packages), but it will be accessible directly without cd to the folder
RUN appmanage.py appconfig appAdd.json || true
...

这只会强行忽略上一个命令的返回退出代码并继续构建。



 类似资料:
  • 因此,我试图在Dockerfile中安装OpenJDK,但遇到了一些问题。它总是以以下消息出错:,然后在。这是执行失败的命令。目前在Ubuntu 20.04VM上 这是一个用5.0编写的Visual Studio项目,需要执行一个。jar文件。这些似乎没有帮助:apt-get update'返回了一个非零代码:100,Docker File非零代码100错误。最好是Java13,但这个问题阻止了我

  • 问题内容: Docker命令构建 问题答案: 问题是github.com/tidwall/tile38/client应该是github.com/tidwall/tile38/pkg/client 现在解决了 @Albin谢谢指出。

  • 问题内容: 我正在尝试从我的docker文件中创建一个docker镜像,其中包含以下内容 哪个失败并出现以下错误 我在Ubuntu 14.04.4上运行 我尝试重新启动docker,清理所有docker映像,安装但无济于事。 我不知道这是怎么了。 问题答案: 因为您有一个https来源。在执行更新之前安装。

  • 我试图在AmazonSageMaker中使用DockerFile构建一个映像,但是我得到了以下错误。 回溯(上次调用): 文件“/usr/bin/pip3”,第9行,从pip导入主导入错误:无法导入名称“main”命令“/bin/sh-c pip3 install--升级pip setuptools wheel 我的DockerFile如下所示

  • 我试图安装一些需要的扩展PHP使用docker。 这是我的Dockerfile: 下面是我得到的错误: 错误: /usr/src/php/ext/mysql不存在 用法:/usr/local/bin/docker php ext install[-jN]ext name[ext name…]ie:/usr/local/bin/docker php ext install gd mysqli/usr