Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the authoritative list of Docker Run exit codes?

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?

like image 355
jeesty Avatar asked Jul 08 '15 15:07

jeesty


People also ask

What is docker exit code 127?

Exit Code 127 means a command specified in the container specification refers to a non-existent file or directory. What to do if a container terminated with Exit Code 127? Same as Exit Code 126, identify the failing command and make sure you reference a valid filename and file path available within the container image.

What is exit code 255 docker?

The 255 error simply means “there was an error”, but does not tell you anything much besides that. Normally, you come across this error while starting the docker quickstart terminal. For instance, the error appears as shown below in the image.

How do I find the exit code for a container?

You can even get the exit code without any extra cruft by running docker inspect 61c6 --format='{{. State. ExitCode}}' . That's perfect for scripts because you can check the code easily.


1 Answers

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 7 signal or check online e.g. signal).

Check Docker's exit status documentation for more information about the current version.

like image 74
Tombart Avatar answered Oct 05 '22 03:10

Tombart