Implementation of docker view container log command

Implementation of docker view container log command

Why should we read the log? For example, if the container fails to start but no prompt is given, we need to check why.

View the logs:

Command format:

$ docker logs [OPTIONS] CONTAINER
 Options:
    --details Display more information -f, --follow Track real-time logs --since string Display logs after a certain timestamp, or relative time, such as 42m (i.e. 42 minutes)
    --tail string How many lines of log are displayed from the end of the log, the default is all
  -t, --timestamps Display timestamps --until string Display logs before a certain timestamp, or relative time, such as 42m (i.e. 42 minutes)

example:

View the logs after the specified time and only display the last 100 lines:

$ docker logs -f -t --since="2020-02-08" --tail=50 CONTAINER_ID

View the logs for the last 30 minutes:

$ docker logs --since 30m CONTAINER_ID

View the logs after a certain time:

$ docker logs -t --since="2020-02-08T13:23:37" CONTAINER_ID

View logs for a certain period of time:

$ docker logs -t --since="2020-02-08T13:23:37" --until "2020-02-09T12:23:37" CONTAINER_ID

This is the end of this article about the implementation of docker view container log command. For more relevant docker view container log command content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Docker container log analysis
  • How to view and clean up Docker container logs (tested and effective)

<<:  HTML table tag tutorial (21): row border color attribute BORDERCOLOR

>>:  Native JS to implement drag position preview

Recommend

Detailed tutorial on installing Python 3.6.6 from scratch on CentOS 7.5

ps: The environment is as the title Install possi...

How to make your own native JavaScript router

Table of contents Preface Introduction JavaScript...

Several ways to update batches in MySQL

Typically, we use the following SQL statement to ...

JavaScript implements password box input verification

Sometimes it is necessary to perform simple verif...

In-depth understanding of Vue transition and animation

1. When inserting, updating, or removing DOM elem...

How to optimize MySQL performance through MySQL slow query

As the number of visits increases, the pressure o...

MySQL 5.7.17 installation and configuration graphic tutorial

Features of MySQL: MySQL is a relational database...

js to create a carousel effect

I think the carousel is a relatively important po...

How to fix the width of table in ie8 and chrome

When the above settings are used in IE8 and Chrome...

Summary of JavaScript Timer Types

Table of contents 1.setInterval() 2.setTimeout() ...

About the garbled problem caused by HTML encoding

Today a junior student asked a question. The HTML...