Docker · 12-day planAll days
Day 3 of 12 30 minLifecyclelogsExit codes
Master the container lifecycle. Run containers in the foreground and background, name them, read their logs, understand why some exit straight away, read exit codes, restart them automatically, and clean up with --rm.
By the end of today you can
- Follow a container through created, running, exited and removed
- Choose between foreground and detached (-d) containers
- Read logs with docker logs, --tail and -f
- Explain why a container stops when its main process ends, and read its exit code
- Use --rm, restart policies and one-off commands
What's inside
- 6 sections
- 2 diagrams and mind maps
- 7 code examples you can run
- 5-question quiz
- 1The lifecycle
- 2One process per container
- 3Foreground and background
- 4Exit codes
- 5Restart policies
- 6Cleaning up
Sign in free to read this lesson
Get the full lesson with diagrams, runnable code and the quiz. Your progress is saved across devices.
Sign in free