AWS ECS容器状态已停止(退出代码12),但运行状况为“健康”

时间:2020-05-14 19:23:20

标签: amazon-web-services containers devops amazon-ecs

我正在运行包含5个容器的ECS任务。此队列容器是该容器的非必需容器。

在我的task-definition.json中,我已经添加了此healthCheck

运行状况检查的配置。

"healthCheck": {
    "retries": 3,
    "command": [
      "CMD-SHELL",
      "ps -p 1 || exit 1"
    ]

容器运行一段时间后,执行一些代码,并以退出代码12停止。“健康状态”始终显示“健康”。

我检查完容器后,那里的“健康状态”不健康。

如何以不正常状态重新启动容器?

容器日志

        "Created": "2020-05-14T18:54:41.951259491Z",
        "Path": "docker-php-entrypoint",
        "Args": [
            "php",
            "/var/www/project/artisan",
            "queue:work",
            "sqs",
            "--sleep=3",
            "--tries=3"
        ],
        "State": {
            "Status": "exited",
            "Running": false,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 0,
            "ExitCode": 12,
            "Error": "",
            "StartedAt": "2020-05-14T18:54:43.420548498Z",
            "FinishedAt": "2020-05-14T18:58:03.255740325Z",
            "Health": {
                "Status": "unhealthy",
                "FailingStreak": 1,
                "Log": [
                    {
                        "Start": "2020-05-14T18:57:20.893718181Z",
                        "End": "2020-05-14T18:57:21.732193966Z",
                        "ExitCode": 0,
                        "Output": "  PID TTY          TIME CMD\n    1 ?        00:00:50 php\n"
                    },
                    {
                        "Start": "2020-05-14T18:57:31.74021937Z",
                        "End": "2020-05-14T18:57:32.276193255Z",
                        "ExitCode": 0,
                        "Output": "  PID TTY          TIME CMD\n    1 ?        00:00:52 php\n"
                    },
                    {
                        "Start": "2020-05-14T18:57:42.284266865Z",
                        "End": "2020-05-14T18:57:42.816077655Z",
                        "ExitCode": 0,
                        "Output": "  PID TTY          TIME CMD\n    1 ?        00:00:54 php\n"
                    },
                    {
                        "Start": "2020-05-14T18:57:52.821305588Z",
                        "End": "2020-05-14T18:57:53.164295863Z",
                        "ExitCode": 0,
                        "Output": "  PID TTY          TIME CMD\n    1 ?        00:00:56 php\n"
                    },
                    {
                        "Start": "2020-05-14T18:58:03.18337104Z",
                        "End": "2020-05-14T18:58:03.254003644Z",
                        "ExitCode": -1,
                        "Output": "OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused \"process_linux.go:101: executing setns process caused \\\"exit status 1\\\"\": unknown"
                    }
                ]

0 个答案:

没有答案