Apologies if this has been asked, but nowhere in the Docker documentation can I find an authoritative list of exit codes (also called exit status). Surprising! I see suggestions about making it consistent, but no docs on docker.com.
Does anyone know where the exit codes can be found?
答案 0 :(得分:50)
对于Docker> = 1.10,请参阅标准this PR后的chroot exit codes:
125
:docker run
本身失败126
:无法调用包含的命令127
:如果找不到包含的命令128 + n
致命错误信号n
:
130
= (128+2)
容器由Control-C终止137
= (128+9)
容器收到SIGKILL
143
= (128+15)
容器收到SIGTERM
查看signal
的手册页以获取完整列表(在cmd类型man signal
上或在线查看,例如signal)。
检查Docker documentation以获取有关当前版本的更多信息。
答案 1 :(得分:11)
通常它将是该过程的退出状态,因此它依赖于应用程序,即:
$ docker run debian sh -c "exit 5;"
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7fcc37778df0 debian "sh -c 'exit 5;'" 4 seconds ago Exited (5) 3 seconds ago reverent_einstein
但在某些情况下,Docker本身可以返回退出代码:
答案 2 :(得分:0)
Docker退出代码在official Docker documentation中有详细记录。