docker image ubuntu:16.04 seems to omit some files for logrotate

China☆狼群 提交于 2019-12-10 21:00:08

问题


I built an image based on ubuntu:16.04. While building the image I did run some commands including apt-get -y update.

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.

For instance, /etc/logrotate.conf, /usr/sbin/logrotate, /var/lib/logrotate/status.

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)

How could I make it with the ubuntu16:04 image?


回答1:


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.

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.



来源:https://stackoverflow.com/questions/47113677/docker-image-ubuntu16-04-seems-to-omit-some-files-for-logrotate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!