docker logs
Shows what a container main process wrote to standard output and standard error.
In more detail
It works on running and stopped containers, which makes it the first thing to read when something fails. -f follows new lines, --since and --tail limit the output. Applications in containers should log to standard output rather than to files, so docker logs and log drivers can collect them.
Example
docker logs --tail 50 -f taskapi-demoRelated terms
- standard output and standard error — The two channels a program writes normal output (stdout) and error messages (stderr) to, plus stdin for input.
- logging driver — The part of Docker that decides where container logs go, such as a local file or a central log service.
- log rotation — Capping log files by size or count so old lines are deleted before they fill the disk.
- docker inspect — Prints everything Docker knows about a container or image as JSON: state, configuration, mounts, network settings and more.
Taught in
- Monitoring With The Built-in CLI — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Container Logs — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Install Docker And Verify Your Environment — Docker Architecture & Production Containers
- Run, Stop, Restart And Remove A Container — Docker Architecture & Production Containers
- Commands, Logs, Exec And Exit Codes — Docker Architecture & Production Containers
- Run The Spine Service And Publish Its Port — Docker Architecture & Production Containers
- CMD, ENTRYPOINT, USER And Process Signals — Docker Architecture & Production Containers
- Port Publishing, Localhost And Network Troubleshooting — Docker Architecture & Production Containers
- Diagnose Crashes, Resource Limits And Unhealthy Containers — Docker Architecture & Production Containers