How to View Logs for a Docker Container
II. How To List and Attach to Docker Containers
III. 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.
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.
Related Articles:

About the Author: J. Mays
As a previous contributor, JMays shares his insight with our Knowledge Base center. In our Knowledge Base, you'll be able to find how-to articles on Ubuntu, CentOS, Fedora and much more!
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.
Latest Articles
How to Install Adminer MySQL Database Management Tool on AlmaLinux
Read ArticleWhat is CGI-Bin and What Does it Do?
Read ArticleTop 10 Password Security Standards
Read ArticleTop 10 Password Security Standards
Read ArticleHow to Use the WP Toolkit to Secure and Update WordPress
Read Article