Docker: You’ve got mail!

by | Feb 24, 2021

So far we’ve chosen base images for our Icinga 2, Icinga Web 2 and Icinga DB Docker images, further reduced the image size and even taken care for security and comfort. Additionally Eric put all the images together via Docker Compose. But there’s still one little thing… e-mail.

Problem

A perfectly designed Docker image runs exactly one application in the foreground. Maybe dumb-init is needed because applications like Icinga 2 spawn more and more subprocesses and rely on the init system to automatically clean up them. But actually the container runs exactly one daemon. This design requirement isn’t a problem – as long as one doesn’t send notifications via e-mail. Icinga 2’s shipped mail notification scripts use the mail binary which uses the sendmail command. The latter one relies on a local MTA… which isn’t running as there shall be only one daemon.

Solution

Fortunately Michael suggested msmtp which doesn’t require a local MTA – configuring a remote one is enough. Additionally the msmtp-mta package provides a drop-in replacement for the sendmail binary. I.e. Icinga 2’s scripts use mail which uses sendmail (actually msmtp-mta) which sends the notification via the configured actual MTA.

Conclusion

What else do you consider missing in our images? Join the discussion on Discourse and GitHub!

You May Also Like…

Subscribe to our Newsletter

A monthly digest of the latest Icinga news, releases, articles and community topics.