Skip to main content

How to view docker container logs

How to see docker container logs

Introduction

If you are running your container in -d (detached mode) or by docker remote API, you will not see any logs in console. To access running docker image or container logs you need to use docker logs command.

In this tutorial, I will list out various commands to display logs

To see docker containers logs make sure that first of all, docker container is running you can check this by using

Once you have confirmed that docker container is up and running you can use following commands

  • To see all the logs of a particular container

  • To follow docker log output or tail continuously

  • To see last n lines of logs

    In this case, last 2500 lines will be displayed

  • To see logs since particular date or timestamp

    First get the Timestamp format in logs using

    Now use the timestamp which should be in format like this 2017-05-03T10:00:59.935397007Z and use it to display logs

    For e.g if only a day’s log needs to be viewed


    For e.g if only a day’s log needs to be viewed since 10 am

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Bitnami