python - Docker 进程被神秘的 `Killed` 消息杀死

标签 python macos docker docker-machine

在 docker 容器中运行 python 脚本,一切似乎都运行顺利,看到一些 STDOUT 消息,大约 5 分钟后,我收到一条 Killed 消息,没有进一步的解释,进程停止。查询数据库,因此可能是磁盘空间问题,也可能是 OOM 问题。我不确定,但我不知道在哪里可以找到有关此终止消息的日志,以便找到问题的根源。这些日志在哪里有什么想法吗?

在 Mac OSX 上运行 docker-machine。

这就是消息所说的全部内容!

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

谢谢!

最佳答案

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.

关于python - Docker 进程被神秘的 `Killed` 消息杀死,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44417159/

相关文章:

java - 不使用带参数的 java -jar 打开 Jar

meteor - 同一主机上容器之间的 meteor DDP调用

python - -753 在 `pd.Timestamp` 中的时区意味着什么

带有嵌套列表创建的 Python CSV 导入

c# - 在 Mac 上使用 C#/Mono 的仅系统托盘(无停靠图标)应用程序

Macbook 上的 android 应用程序问题

nginx - 为什么当我尝试挂载卷时 Docker 无法打开 nginx.conf?

python - Docker Flask ModuleNotFoundError : No module named 'flask'

python - 如何在 Python 中进行环境变量更改?

java - Python 代码转换为 JVM