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

How to view the container log of docker

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article introduces the knowledge of "how to view the container log of docker". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

View docker container logs in real time

$sudo docker logs-f-t-- tail number of rows container name

View container details

Docker inspect 7a20f9671dbd

Find LogPath through the details, then it is under the directory structure of the host

"LogPath": "/ var/lib/docker/containers/7a20f9671dbd972d1e94355c15b74236e36a9eb72da4636cb7e996e1a9cdd40c/7a20f9671dbd972d1e94355c15b74236e36a9eb72da4636cb7e996e1a9cdd40c-json.log"

Logback is in the container through file, and directly enters the container to obtain log files, which can be copied to the host through the cp command.

The docker attach [options] container connects to the running container and prints the container's standard input, output, and error stream information locally.

The docker logs [options] container gets the log of the container.

-details display additional details provided to the log-follow or-f output by log-since displays from a certain time-tail displays from how many lines at the end of the log-timestamps or-t displays timestamps-until prints the log before a certain time. "how to view docker's container log" is introduced here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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: 283

*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