Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the command for docker to view the container log

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "what is the command for docker to view the container log". In the daily operation, I believe that many people have doubts about the command of docker to view the container log. The editor has consulted all kinds of information and sorted out a simple and easy-to-use method of operation. I hope it will be helpful to answer the doubt of "what is the command of docker to view the container log?" Next, please follow the editor to study!

You can view the container's log through the docker logs command.

Command format:

$docker logs [OPTIONS] CONTAINEROptions:--details displays more information-- f,-- follow tracks real-time logs-- since string displays logs since a certain timestamp, or relative time, such as 42m (that is, 42 minutes)-- how many lines of logs are displayed by tail string from the end of the log, default is all-t,-- timestamps displays timestamps-- until string displays logs before a certain timestamp, or relative time, such as 42m (that is, 42 minutes)

For example

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

$docker logs-f-t-since= "2019-08-08"-tail=100 CONTAINER_ID

View the log for the last 30 minutes:

$docker logs-- since 30m CONTAINER_ID

Using tail to view the tail of log, the effect is the same as Linux's tail-n20filename, showing the last 20 lines.

$docker logs-- tail 20

At this point, the study on "what is the command for docker to view container logs" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report