gpt4 book ai didi

docker - 鉴于容器错误状态代码,在哪里可以找到更明确的错误?

转载 作者:行者123 更新时间:2023-12-01 02:43:55 31 4
gpt4 key购买 nike

我实际上是通过 Mesos 运行任务堆栈,使用 Docker容器。

有时,某些任务会失败。

以下是一些相关的TaskStatus消息和原因:

message: Container exited with status 1 - reason: REASON_COMMAND_EXECUTOR_FAILED
message: Container exited with status 42 - reason: REASON_COMMAND_EXECUTOR_FAILED
message: Container exited with status 137 - reason: REASON_COMMAND_EXECUTOR_FAILED

是否有链接来自 TaskStatus 的容器错误状态代码的对应表带有更明确错误的消息?

最佳答案

命令任务可能会因多种原因而失败并设置正确的退出代码。例如 Docker 1.10 设置这样的退出状态代码( from documentationthis answer ):

The exit code from docker run gives information about why the container failed to run or why it exited. When docker run exits with a non-zero code, the exit codes follow the chroot standard, see below:

125 if the error is with Docker daemon itself:

$ docker run --foo busybox; echo $?
# flag provided but not defined: --foo See 'docker run --help'.

126 if the contained command cannot be invoked:

$ docker run busybox /etc; echo $?
# docker: Error response from daemon: Container command '/etc' could not be invoked.

127 if the contained command cannot be found

$ docker run busybox foo; echo $?
# docker: Error response from daemon: Container command 'foo' not found or does not exist. 127 Exit code of contained command

otherwise

$ docker run busybox /bin/sh -c 'exit 3'; echo $?
# 3


可以找到另一个退出代码规则 here
| Code  |            Meaning             |         Example         |                                                   Comments                                                   |
|-------|--------------------------------|-------------------------|--------------------------------------------------------------------------------------------------------------|
| 1 | Catchall for general errors | let "var1 = 1/0" | Miscellaneous errors, such as "divide by zero" and other impermissible operations |
| 2 | Misuse of shell builtins | empty_function() {} | Missing keyword or command, or permission problem (and diff return code on a failed binary file comparison). |
| 126 | Command invoked cannot execute | /dev/null | Permission problem or command is not an executable |
| 127 | "command not found" | illegal_command | Possible problem with $PATH or a typo |
| 128 | Invalid argument to exit | exit 3.14159 | exit takes only integer args in the range 0 - 255 (see first footnote) |
| 128+n | Fatal error signal "n" | kill -9 $PPID of script | $? returns 137 (128 + 9) |
| 130 | Script terminated by Control-C | Ctl-C | Control-C is fatal error signal 2, (130 = 128 + 2, see above) |
| 255* | Exit status out of range | exit -1 | exit takes only integer args in the range 0 - 255 |

根据你的例子:
  • 137 Out Of Memory ;
    128 + 9 = 137 (9 coming from SIGKILL) 并且可能被转码为内存不足错误并杀死。
  • 1 – 命令退出 1 .可能是由于无效配置、内部应用程序错误或无效输入。
  • 42 ——

    Answer to the Ultimate Question of Life, the Universe, and Everything

  • 如果您需要更多信息来解释状态代码,您可以查看 Message Mesos TaskStatus 更新中的字段,例如 Mesos 将有关 OOM 的信息放在那里。在 Mesos 日志中也可以找到相同的信息。要调试命令返回非零代码的原因,您可以检查存储在执行器沙箱中的文件,尤其是 stderr/stdout 或命令特定日志。

    关于docker - 鉴于容器错误状态代码,在哪里可以找到更明确的错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43803610/

    31 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com