What is the authoritative list of Docker Run exit codes?

一曲冷凌霜 提交于 2019-11-28 18:11:33
Tombart

For Docker >= 1.10 see this PR, which follows standard chroot exit codes:

  • 125: docker run itself fails
  • 126: contained command cannot be invoked
  • 127: if contained command cannot be found
  • 128 + n Fatal error signal n:
    • 130 = (128+2) Container terminated by Control-C
    • 137 = (128+9) Container received a SIGKILL
    • 143 = (128+15) Container received a SIGTERM

Check the man page of signal for the full list (on cmd type man signal or check online e.g. signal).

Check Docker documentation for more information about the current version.

Normally it will be the exit status of the process, so it's application dependent i.e:

$ 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   

But in certain cases Docker itself can return an exit code:

  • 125 if the Docker daemon has an error (e.g. a wrong flag is provided)
  • 126 if the container command can't be invoked (e.g. file isn't executable)
  • 127 if the container command can't be found (e.g. wrong path to binary)

https://docs.docker.com/engine/reference/run/#exit-status

Arun Thundyill Saseendran

Docker exit codes are well documented in the official Docker documentation.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!