From 8ca8e567a174d8d7468abedc68f7285b317ef967 Mon Sep 17 00:00:00 2001 From: David Karlsson <35727626+dvdksn@users.noreply.github.com> Date: Thu, 23 Nov 2023 13:49:06 +0100 Subject: [PATCH] docs: improve description about container exit codes Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com> --- docs/reference/run.md | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/docs/reference/run.md b/docs/reference/run.md index 59311d0cbbf5..624cffa6608a 100644 --- a/docs/reference/run.md +++ b/docs/reference/run.md @@ -188,13 +188,15 @@ round-trip min/avg/max = 0.257/0.288/0.326 ms For more information about container networking, see [Networking overview](https://docs.docker.com/network/) -## Exit Status +## Exit status 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: +failed to run or why it exited. When `docker run` exits with a non-zero code, +the exit codes follow the `chroot` standard. -**_125_** if the error is with Docker daemon **_itself_** +### 125 + +Exit code `125` indicates that the error is with Docker daemon itself. ```console $ docker run --foo busybox; echo $? @@ -204,7 +206,10 @@ See 'docker run --help'. 125 ``` -**_126_** if the **_contained command_** cannot be invoked +### 126 + +Exit code `126` indicates that the specified contained command can't be invoked. +The container command in the following example is: `/etc; echo $?`. ```console $ docker run busybox /etc; echo $? @@ -213,7 +218,9 @@ docker: Error response from daemon: Container command '/etc' could not be invoke 126 ``` -**_127_** if the **_contained command_** cannot be found +### 127 + +Exit code `127` indicates that the contained command can't be found. ```console $ docker run busybox foo; echo $? @@ -222,7 +229,10 @@ docker: Error response from daemon: Container command 'foo' not found or does no 127 ``` -**_Exit code_** of **_contained command_** otherwise +### Other exit codes + +Any exit code other than `125`, `126`, and `127` represent the exit code of the +provided container command. ```console $ docker run busybox /bin/sh -c 'exit 3'