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

Exit Code — 137 이 뭐냐

~12 min · debug, lifecycle

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

실제로 만날 코드들

코드의미가능성 큰 원인
0깔끔한 exitProcess 끝남 — 근데 안 끝났어야 했을 수도. 장기 실행 서비스는 자기 혼자 0 exit 면 안 됨.
1앱 에러코드 throw, config 잘못, DB 도달 X. logs 읽어.
125Docker 데몬 에러잘못된 flag, 포트 bind X, image 없음.
126Permission deniedCMD 가 실행 가능 아니거나, USER 권한 부족.
127명령 없음CMD 경로 틀림; image 의 PATH 에 binary 없음.
137SIGKILL (128+9)OOM-killer 가 죽임. --memory 한도 침.
139SIGSEGV (128+11)Native crash. alpine 의 musl/glibc mismatch 자주.
143SIGTERM (128+15)정상 stop — 아니면 K8s rollout 중에.

Code

OOM 즉시 잡기·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

이 exit code 들 의도적으로 발생시켜서 캡처: 0, 1, 126 (CMD chmod -x), 127 (CMD 경로 틀림), 137 (--memory 너무 낮음). 각 원인이랑 surface 한 진단 명령 문서화.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.