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 principle of logs log in docker

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

Today, I will talk to you about the principle of logs log in docker, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

Parameter description $docker logs [OPTIONS] CONTAINEROptions:-- details displays more information-- f,-- follow tracks the log output, and the log of the last behavior current timestamp-- since string displays the log from a specific time or time period-- how many lines of log does tail string display from the end of the log? The default is all-t -- timestamps display timestamp usage $docker logs 26b12d17fefc nohup: appending output to 'nohup.out' nohup: appending output to' nohup.out'$ docker logs-- tail 1 26b12d17fefc nohup: appending output to 'nohup.out'$ docker logs-t-- tail 1 26b12d17fefc 2017-07-03T13:58:54.232003809Z nohup: appending output to' nohup.out'$ docker logs-- since 30m 26b12d17fefc nohup: appending output to 'nohup.out'$ docker logs-t-since= "2017-07-- 03T13:58:54.232003809Z "26b12d17fefc 2017-07-03T13:58:54.232003809Z nohup: appending output to 'nohup.out'$ docker logs-t-- since=" 2017-07-03T12:12:29.909710295Z "26b12d17fefc 2017-07-03T12:12:29.909710295Z nohup: appending output to' nohup.out' 2017-07-03T13:58:54.232003809Z nohup: output form of appending output to 'nohup.out' container log

Stdout standard output

Stderr standard error

Stored in the container to the log file in json format

Docker log content type

Log contents of Daemon when docker itself runs

Log contents of the docker container

The realization principle of docker logs

"Docker Daemon is a system process resident in the background in Docker architecture. It starts a Server,Server in the background to accept requests sent by Docker Client. After accepting the request, Server finds the corresponding Handler to execute the request through routing and distribution scheduling. -" Docker source code analysis ""

When we enter docker logs, it will be converted to Docker Client to initiate a request to Docker Daemon, and Docker Daemon will create a goroutine when running the container, which binds the standard output file descriptors of all processes in the container. Therefore, all the standard output logs applied in the container will be received by goroutine. Docker Daemon will read the log contents according to the container id and log type, and eventually output them to the user terminal and store them in the / var/lib/docker/containers directory in json format.

After reading the above, do you have any further understanding of the principle of logs logs in docker? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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

Internet Technology

Wechat

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

12
Report