Skip to content

Commit

Permalink
docs: improve description about container exit codes
Browse files Browse the repository at this point in the history
Signed-off-by: David Karlsson <[email protected]>
  • Loading branch information
dvdksn committed Nov 23, 2023
1 parent 7ed034a commit 8ca8e56
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions docs/reference/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 $?
Expand All @@ -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 $?
Expand All @@ -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 $?
Expand All @@ -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'
Expand Down

0 comments on commit 8ca8e56

Please sign in to comment.