Docker进程被神秘的'killed'消息杀死

2024-04-25 21:54:47 发布

您现在位置:Python中文网/ 问答频道 /正文

在docker容器中运行python脚本,一切看起来都运行得很顺利,看到一些STDOUT消息,大约5分钟后,我收到一条Killed消息,没有进一步的解释,进程就停止了。查询数据库可能是磁盘空间问题,也可能是OOM问题。我不确定,但是我不知道在哪里可以找到关于这个杀戮消息的日志,这样我就可以找到这个问题的根源。你知道这些日志在哪里吗?

在MacOSX上运行docker机器。

所有的信息都是这么说的!

root@c7b800e0f276:/opt/mymodule# python
Python 2.7.13 (default, May  1 2017, 22:44:36)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from mymodule import model
>>> model.run('2017-04-01')
INFO:Deleting from input table.
INFO:Inserting into input table.
INFO:Querying input table for chunk.
Killed
root@c7b800e0f276:/opt/mymodule# exit

谢谢!


Tags: dockerfrominfo脚本消息forinputmodel
2条回答

使用Docker for Mac,您可以使用以下命令进入主机虚拟机命名空间:

docker run --net=host --ipc=host --uts=host --pid=host -it --security-opt=seccomp=unconfined --privileged --rm -v /:/host alpine /bin/sh

然后运行chroot /host将根目录更改为主机装载。现在,您可以使用诸如dmesg之类的实用程序来检查任何OOM消息(如问题建议的注释)。

默认情况下,Docker for Mac将可用资源限制为2GB!这对于我运行的应用程序来说太低了。我正在尝试的解决方案是将内存限制提高到8GB。

(尽管我使用的是JVM应用程序,而不是Python,但我也遇到了类似的问题,这里是通过Google搜索找到的。从@sergiu删除的答案中,我能够找出问题所在。)

Get started with Docker for Mac说:

Advanced

Advanced settings are:

CPUs: By default, Docker for Mac is set to use half the number of processors available on the host machine. To increase processing power, set this to a higher number; to decrease, lower the number.

Memory: By default, Docker for Mac is set to use 2 GB runtime memory, allocated from the total available memory on your Mac. To increase RAM, set this to a higher number; to decrease it, lower the number.

Swap: Configure swap file size as needed. The default is 1 GB.

相关问题 更多 >