Sitemap
Better Programming

Advice for programmers.

Understanding Docker Container Exit Codes

The most common exit codes, what they mean, and what causes them

4 min readOct 21, 2019

--

Press enter or click to view image in full size
Docker container exit code — how to use them for troubleshooting?

It’s one of the most common question that I come across: “Why is my container not running?”

Can docker container exit codes help troubleshoot this issue?

The first step in answering this question is to identify the exit code for the docker container. The exit code may give a hint as to what happened to stop the container running. This article lists the most common exit codes when working with docker containers and aims to answer two important questions:

  • What does this specific exit code mean?
  • What action caused this exit code?

This will ultimately help answer the original question: “Why is my container not running?”

How to Find Exit Codes

Option 1: List all containers that exited

docker ps --filter "status=exited"

Option 2: Grep by container name

docker ps -a grep <container-name>Example: docker ps -a | grep hello-world

Option 3: Inspect by container id

--

--

Sandeep Madamanchi
Sandeep Madamanchi

Written by Sandeep Madamanchi

Hands-on with Cloud Platform Infrastructure, GCP & AWS Certified, and Supply Chain Domain Expert

Responses (6)