Debugging with Logs¶
Problem¶
Something is not working, and you need to find out what the container is actually doing.
Symptoms¶
A container errors, returns an unexpected result, or behaves differently than you expect.
The First Move¶
Almost every Docker problem starts here. Read what the container printed.
Useful Variations¶
Follow logs live as they happen.
Show only the most recent lines.
For Compose, view all services together.
Reading the Output¶
- A stack trace or error message points directly at the cause
- "connection refused" or "could not resolve host" suggests a networking problem
- No output at all may mean the app logs to a file instead of the screen
Why This Matters¶
A browser or client often shows only a vague error. The logs show the real cause. When in doubt, check the logs before changing anything.