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

The 'Why Won't It Start?' Checklist

~14 min · debug

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

The seven steps in order

  1. docker ps -a | grep myapp — does the container exist? What's its status?
  2. docker logs --tail 100 myapp — what did it say before dying?
  3. docker inspect myapp --format '{{.State.ExitCode}}' — what was the exit code?
  4. docker run -it --rm <image> sh — can you even start a shell from this image?
  5. docker exec -it myapp sh — if it's running but broken, get inside.
  6. docker port myapp — are ports actually mapped?
  7. docker network inspect <net> — is it on the right network with the right peers?

Code

Walk the checklist·bash
# 1
docker ps -a --format 'table {{.Names}}\t{{.Status}}\t{{.Image}}'

# 2
docker logs --tail 100 myapp

# 3
docker inspect myapp --format 'state={{.State.Status}} exit={{.State.ExitCode}}'

# 4 — sanity check the image itself
docker run -it --rm myapp:1.0 sh

# 5 — get inside a running but broken container
docker exec -it myapp sh

# 6
docker port myapp

# 7
docker network inspect bridge

External links

Exercise

Intentionally break a container three different ways: (a) wrong CMD path, (b) port already in use, (c) missing env var the app reads at startup. For each, walk the 7-step checklist and identify which step revealed the cause.

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.