Ad space (banner)
AD

Got the fundamentals? A structured Docker course is a fast way to level up.

Find Docker courses on Udemy

Affiliate link. Costs you nothing extra.

🐳Docker Lessons
Lesson 21 / 45

Reading Logs with docker logs

When something goes wrong, use docker logs. It shows what the container has printed to standard output and standard error.

The syntax is docker logs container. Add -f to follow the output live.

Running docker logs web prints the container's startup messages and access logs, so you can see what happened.

A common stumble is looking for log files inside the container. Containerized applications are expected to log to standard output — that is what Docker collects.

In real work, it is the first thing you check when a container exits unexpectedly or an application misbehaves.

Docker
Try it (type this into the pseudo terminal)
docker logs web

🧑‍💻 You can type this command into the Docker pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)