I created docker container like this:
FROM debian
RUN export DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y syslog-ng syslog-ng-core
RUN apt-get install -y postfix vim \
&& rm -rf /var/lib/apt/lists/*
CMD /etc/init.d/postfix start && /bin/bash
And start it like this:
docker run --name testmailsrv -p 25:25 -p 143:143 -p 993:993 -v mailsrvpostfixetc:/etc/postfix -v mailsrvdovecotetc:/etc/dovecot -it mailsrv/mailsrv-0.6:latest
My postrix is not working properly, but I can't find any logs to diagnose it. No file /var/log/mail.log, no output from journalclt, nothing interesting from "docker logs" command. How can I see any log from postfix in docker?
This image suggests:
# Use syslog-ng to get Postfix logs (rsyslog uses upstart which does not seem
# to run within Docker).
run apt-get install -q -y syslog-ng
expose 25
cmd ["sh", "-c", "service syslog-ng start ; service postfix start ; tail -F /var/log/mail.log"]
That might be easier in order to produce and see those logs (as output of the main thread)
Also, satnhak suggests in the comments (in 2021):
You probably also need this:
syslog-ng/syslog-ngissue 2407
That refers to syslog-ng/syslog-ng PR 2408: "system-source: check if /proc/kmsg can be opened".
Or you would need in your configuration:
source s_local {
system(
exclude-kmsg(yes)
);
internal();
};
satnhak adds:
adding this to the Dockerfile does the trick:
RUN sed -i 's/system()/system(exclude-kmsg(yes))/g' \ /etc/syslog-ng/syslog-ng.conf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With