Chapter 01015 mins • advanced
Debugging & Troubleshooting Containers
Logs, Shell Exec, Exit Codes & Diagnostic Workflows
What You Will Master:
Diagnose crash loops and Exit Code 1 / 137 issues
Inspect container environment and network interfaces via `docker exec`
Troubleshoot port conflicts and network isolation
The Troubleshooting Toolkit
When a container fails:
1. `docker ps -a`: Check exit code and status.
2. `docker logs <name>`: Inspect stdout/stderr error stack traces.
3. `docker inspect <name>`: Check environment variables, IP, and mount points.
4. `docker exec -it <name> sh`: Step inside the running container to run curl/ping tests.
Interactive Lab
Inspect Logs and Check Container Stats
Inspect the logs and live resource stats of an active container.
0/1 Steps Done
Step 1: Inspect logs of running web container
Run `docker logs web` or `docker stats`
Chapter Knowledge Check
Take the interactive MCQ test to unlock bonus XP
Sponsor & Resources