[英]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.