C.W.K.
Stream
Lesson 02 of 03 · published

Exit Codes — What 137 Means

~12 min · debug, lifecycle

Level 0Container Curious
0 XP0/36 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

The codes you'll actually meet

CodeMeaningLikely cause
0Clean exitProcess finished — but maybe it shouldn't have. Long-running services should never exit 0 on their own.
1Application errorYour code threw, your config is bad, your DB is unreachable. Read logs.
125Docker daemon errorBad flag, can't bind port, missing image.
126Permission deniedCMD isn't executable, or USER lacks permission.
127Command not foundCMD path is wrong; binary isn't in PATH inside the image.
137SIGKILL (128+9)OOM-killer killed it. Hit your --memory limit.
139SIGSEGV (128+11)Native crash. Often musl/glibc mismatch on alpine.
143SIGTERM (128+15)You stopped it normally — or k8s did during a rollout.

Code

Spot OOM the moment it happens·bash
# Run with too-tight memory
docker run --name greedy --memory=50m python:3.12-slim \
  python -c 'a = bytearray(100*1024*1024)'

# Inspect
docker inspect greedy --format 'state={{.State.Status}} exit={{.State.ExitCode}} oom_killed={{.State.OOMKilled}}'
# state=exited exit=137 oom_killed=true

External links

Exercise

Cause each of these exit codes deliberately and capture them: 0, 1, 126 (chmod -x your CMD), 127 (CMD path wrong), 137 (--memory too low). Document each cause and the diagnostic command that surfaced it.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.