IT
Docker generate 2 items when a conatiner is generated.
How does filelog work ?
This means even your file has large size (2GB), it doesn't affect write performance much, why?
The behavior (stdio,stderr –> target) is no difference between a large and small logfile.
https://github.com/moby/moby/blob/master/container/container.go
containerStart
-> InitializeStdio
-> startLogging
-> Generate Copier -> register stdio, stderr and target
-> copier.run()
-> run() : Generate gorouting for stdio and stderr
When copier execute log,which is generated based on log driver configuration, the log checks capacity first and decide to rotate or not.
The flow is :
log
-> WriteLogEntry
-> w.capacity in WriteLogEntry
-> rotate in WriteLogEntry
-> rotate
How docker daemond rotates files.
They are under /run/docker/containerd/<container-id>
Related docs: