问题描述
我基于 ubuntu:16.04
构建了一个图片。在构建映像时,我确实运行了一些命令,包括 apt-get -y update
。
I built an image based on ubuntu:16.04
. While building the image I did run some commands including apt-get -y update
.
然后,我浏览了 docker run -it myimage bash
的图像,我发现其中有一些 logrotate
与普通 ubuntu16.04
操作系统。
Then, I browse the image by docker run -it myimage bash
and I found there are some omitted files for logrotate
in there comparing to normal ubuntu16.04
OS.
例如, /etc/logrotate.conf
, / usr / sbin / logrotate
, / var / lib / logrotate / status
。
即使运行 find / -name logrotate *
,我也找不到它们。 find
命令仅显示 /etc/logrotate.d
( /etc/cron.daily
, /etc/cron.weekly
也存在)。
看到logrotate的like动,如 logrotate.d
,我认为logrotate必须存在于其中。
I could't find them anywhere even with running find / -name logrotate*
. the find
command only show/etc/logrotate.d
(/etc/cron.daily
, /etc/cron.weekly
also exist).Seeing trances of logrotate like logrotate.d
, I assume logrotate must exist in there.
但是,为什么它不仅没有这些文件,而且还没有可执行文件?
我想要他们,因为我想尝试
However, why it doesn't have not only those files but even also executable?I want them because I want to try it(How can I monitor what logrotate is doing)
如何用ubuntu16:04图像实现它?
How could I make it with the ubuntu16:04 image?
推荐答案
(即:没有服务,没有守护程序,没有其他工具)。牢记这一点,因为没有 logrotate守护程序,因此省略logrotate配置文件是很有意义的。
Each container should have only one concern (I.e: no services, no daemons, no additional tools). Having that in mind, it make sense for logrotate configuration files to be omitted, since logrotate daemon is not there.
用于管理日志的替代方法容器可能正在使用共享卷(logrotate然后可以在主机上运行)()或委派给。
Alternatives to manage logs on containers could be using shared volumes (logrotate could then run on the host) (an example of that) or delegating to docker logging drivers.
这篇关于docker image ubuntu:16.04似乎省略了一些文件进行logrotate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!