首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Docker:命令返回非零代码: 137

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

Stack Overflow用户
提问于 2020-02-08 20:35:29
回答 1查看 7.5K关注 0票数 1

我的docker文件如下:

代码语言:javascript
复制
#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"]

当我运行时:

代码语言:javascript
复制
sudo docker build -t test-app .

dockerfile after:RUN appmanage.py appconfig中的步骤如预期的那样成功运行,但之后我得到了错误:

代码语言:javascript
复制
The command '/bin/sh -c appmanage.py appconfig ' returned a non-zero code: 137

当我在谷歌上搜索这个错误时,我得到的建议是“内存不足”。但是我已经验证了,系统(Centos)有足够的内存。

更多信息

在执行RUN appmanage.py appconfig的过程中,命令行输出为:

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-02-10 15:29:31

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

此外,该命令“坚持”自杀,并返回退出代码137。要使其起作用,最小的更改是将您的Dockerfile更新为

代码语言:javascript
复制
...
#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
...

这将强制忽略前一个命令的返回退出代码,并继续构建。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60126842

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档