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

mysql command line script execution example

This article uses an example to illustrate the ex...

Implementing a simple age calculator based on HTML+JS

Table of contents Preface Demonstration effect HT...

MySQL independent index and joint index selection

There is often a lack of understanding of multi-c...

CSS flex several multi-column layout

Basic three-column layout .container{ display: fl...

Summary of Linux Logical Volume Management (LVM) usage

Managing disk space is an important daily task fo...

JavaScript implements page scrolling animation

Table of contents Create a layout Add CSS styles ...

Detailed explanation of the process of using docker to build minio and java sdk

Table of contents 1minio is simple 2 Docker build...

After reading the introduction of CSS box model, you will not be confused

The property names often heard in web design: con...

Implementing search box function with search icon based on html css

Preface Let me share with you how to make a searc...

Detailed explanation of moment.js time and date processing

Monday to Sunday time format conversion (Y --- ye...

Mysql date formatting and complex date range query

Table of contents Preface Query usage scenario ca...

Detailed explanation of redo log and undo log in MySQL

The most important logs in the MySQL log system a...

K3s Getting Started Guide - Detailed Tutorial on Running K3s in Docker

What is k3d? k3d is a small program for running a...