Docker 101: The Basics
How To Install Docker on CentOS 6 or
How To Install Docker on CentOS 7 or
How To Install Docker on Ubuntu 14.04 LTS or
How To Install Docker on Fedora 20 or
How To Install Docker on Fedora 21
How To List and Attach to Docker Containers
How to Commit Changes and Create Docker Images
IV. How to View Logs for a Docker Container
- As of June 2014 Docker has officially released v1.0.0.
- These instructions are intended for viewing logs for Docker containers.
- I’ll be working from a Liquid Web Core Managed CentOS 6.6 server (or CentOS 7, Ubuntu 14.04 LTS, Fedora 20, Fedora 21), and I’ll be logged in as root.
In the previous tutorials in this series we’ve installed Docker and got a container running, we listed which containers were running, and attached to a running Fedora container, and we’ve committed changes and created Docker images.
View Logs for a Docker Container
If you’re currently attached to a docker instance, then first disconnect (detach) from the shell without exiting use the escape sequence Ctrl-p + Ctrl-q.
To view the logs for a container it’s as simple as running just one command. Let’s take a look at the logs for container 2c9d5e12800e :
docker logs 2c9d5e12800e
If you don’t know the container ID, then use this tutorial on how to list docker containers.