简体   繁体   English

一段时间后docker容器中的服务停止

[英]Service inside docker container stops after some time

I have deployed a rest service inside a docker container using uwsgi and nginx. 我已经使用uwsgi和nginx在docker容器内部署了rest服务。 When I run this python flask rest service inside docker container, for first one hour service works fine but after sometime somehow nginx and rest service stops for some reason. 当我在docker容器中运行此python flask rest服务时,最初的一小时服务运行良好,但一段时间后,由于某种原因,nginx和rest服务停止了。

Has anyone faced similar issue? 有没有人遇到过类似的问题? Is there any know fix for this issue? 有没有已知的解决此问题的方法?

Consider doing a docker ps -a to get the stopped container's identifier. 考虑做一个docker ps -a获取停止的容器的标识符。 -a here just means listing all of the containers you got on your machine. -a这里仅表示列出您在计算机上获得的所有容器。

Then do docker inspect and look for the LogPath attribute. 然后执行LogPath docker inspect并查找LogPath属性。 Open up the container's log file and see if you could identify the root cause on why the process died inside the container. 打开容器的日志文件,查看是否可以确定导致进程在容器内死亡的根本原因。 (You might need root permission to do this) (您可能需要root权限才能执行此操作)

Note: A process can die because of anything, eg code fault 注意:进程可能由于任何原因而死亡,例如代码错误

If nothing suspicious is presented in the log file then you might want to check on the State attribute. 如果日志文件中未显示任何可疑内容,则您可能需要检查State属性。 Also check the ExitCode attribute to see if you can work backwards to see which line of your application could have exited using that code. 还要检查ExitCode属性,以查看是否可以向后工作以查看使用该代码可能退出了应用程序的哪一行。

Also check the OOMKilled flag, if this is true then it means your container could be killed due to out of memory error. 还要检查OOMKilled标志,如果为true,则意味着您的容器可能由于out of memory不足错误而被杀死。

Well if you still can't figure out why then you might need to add more logging into your application to give you more insight on why it died. 好吧,如果您仍然不知道为什么,那么您可能需要在应用程序中添加更多日志记录,以便更深入地了解它为何死亡。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Docker Container正在运行,但Docker内部的程序突然停止 - Docker Container is running but the program inside the docker stops abruptly cron 作业中的 Python 脚本在一段时间后停止 - Python script in cron job stops after some time 运行一段时间后,Telegram Bot 停止并报错 - After some running time Telegram Bot stops and gives an error 一段时间后打印到命令行停止工作 - Printing to command line stops working after some time 可以在 Docker 容器内安装 asdf,但不能在构建时通过 Dockerfile - Can install asdf inside Docker container, but not at build time via Dockerfile 是否可以在 same.network 中的其他 docker 容器退出后停止 docker 容器? - Is it possible to stop a docker container after other docker container inside the same network exits? 在 docker 容器内创建 django 应用程序后权限被拒绝 - Permission denied after creating django app inside docker container docker 容器内的操纵杆 - Pyjoystick inside docker container 在 docker 容器内运行 docker 容器 - Running docker container inside docker container Docker 容器 A 在作为另一个 Docker 服务 B 运行的 cassandra 中执行查询(插入/更新)后死亡 - Docker container A dies after excuting query(insert/update) in cassandra running as another docker service B
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM