openfaas容器莫名退出

简介

最近创建了很多的openfaas函数,但是发现一个问题,就是容器会莫名其妙的就退出停止了

操作

容器退出是下面这个样子的

1
2
3
4
5
6
b6d4e81b18ee        reg.bboysoul.cn:5000/weibo:v1.0.1                          "fwatchdog"              2 days ago          Exited (137) 43 hours ago                       weibo.1.a6e63diwlk65y01e2ygpxp912
213c350ef746        reg.bboysoul.cn:5000/weibo:v1.0.1                          "fwatchdog"              2 days ago          Exited (137) 2 days ago                         weibo.1.5sk811e6mk2443jqqhs5rc8jh
7ea15fab5c15        reg.bboysoul.cn:5000/weibo:v1.0.1                          "fwatchdog"              2 days ago          Exited (137) 2 days ago                         weibo.1.012e92o6tuyc5525x8ea49ugf
0c0387ceb86a        d56829648d6e                                               "fwatchdog"              2 days ago          Exited (137) 44 hours ago                       weather.2.wx41u5szc3y0cf6qbo2zpnhvp
cd673223edb3        d56829648d6e                                               "fwatchdog"              2 days ago          Exited (137) 2 days ago                         weather.2.e7ai8vki9qchj1trt53ob7zq4
2b819b7f1793        reg.bboysoul.cn:5000/weather-redis:v1.0.4                  "fwatchdog"              2 days ago          Exited (137) 31 hours ago                       weather-redis.1.i24nh027j4qr1qu6j43v62mow

刚开始以为是内存的问题,所以加了内存

1
2
3
4
    limits:
      memory: 512m
    requests:
      memory: 256m

但是情况还是不变,之后看了容器的详细信息,有一段是下面这样的

docker inspect aa8fc6b16df3

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
            "Health": {
                "Status": "unhealthy",
                "FailingStreak": 1,
                "Log": [
                    {
                        "Start": "2020-08-07T05:15:14.215208046+08:00",
                        "End": "2020-08-07T05:15:14.646180265+08:00",
                        "ExitCode": 0,
                        "Output": ""
                    },
                    {
                        "Start": "2020-08-07T05:15:17.673740529+08:00",
                        "End": "2020-08-07T05:15:18.314430724+08:00",
                        "ExitCode": 0,
                        "Output": ""
                    },
                    {
                        "Start": "2020-08-07T05:15:21.340407903+08:00",
                        "End": "2020-08-07T05:15:21.852773024+08:00",
                        "ExitCode": 0,
                        "Output": ""
                    },
                    {
                        "Start": "2020-08-07T05:15:24.877707477+08:00",
                        "End": "2020-08-07T05:15:25.468700047+08:00",
                        "ExitCode": 0,
                        "Output": ""
                    },
                    {
                        "Start": "2020-08-07T05:15:28.498993972+08:00",
                        "End": "2020-08-07T05:15:28.822153747+08:00",
                        "ExitCode": -1,
                        "Output": "ttrpc: closed: unknown"
                    }
                ]
            }
        },

也就是在健康检查的时候出了问题,所以容器退出了

那么我就去掉了模板里面健康检查的项目

观察了几天,容器正常了

欢迎关注我的博客 www.bboy.app Have Fun