...

/

Reviewing Docker Container Exit Codes

Reviewing Docker Container Exit Codes

Understand what Docker container exit codes are, and how to review them.

Docker container exit codes are integer codesInteger codes are data types that are used in place of real numbers that don’t have fractional values. that are represented when a Docker container exits. They give an overview of the state of the container. The exit codes are numbers between 0 and 255. These are the codes we’ll be analyzing and reviewing during this section.

Press + to interact

When a Docker container exits, it means that the container won’t be found among running containers in the environment. It’ll only be found under exited containers with the docker ps -a command.

Reviewing Docker container exit codes

We’ll be reviewing Docker container exit codes, but before going into that we’ll need to understand some signs that are shown on the environment when a container exits.

Understanding signals

In the UNIX operating system, signals are used for communication between objects in the environment. The same scenario is also applicable in the Docker container environment to manage the container life cycle. Here are some of the common signals used in Docker:

  • The SIGINT (2) signal: This signal is sent when the user uses the “Ctrl+C” keys from their keyboard. Sending this will cause the container to stop and exit.

  • The SIGTERM (15) signal: This signal is used to process termination on the Docker environment. Sending this signal will shut down the container.

  • The SIGKILL (9) signal: This signal is used for the forceful termination of containers in Docker. It makes Docker perform termination without a chance to clean up any resource within.

  • ...