Skip to content

Instantly share code, notes, and snippets.

@porjo
Last active August 29, 2015 14:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save porjo/35ea98cb64553c0c718a to your computer and use it in GitHub Desktop.
Save porjo/35ea98cb64553c0c718a to your computer and use it in GitHub Desktop.
Docker and postfix

UPDATE: 2014/09/05

Looks like this is now fixed as of Docker v1.2.0


For the benefit of the interwebs I'm documenting this here as I've spent several hours pulling my hair out.

Postfix does not play well inside a docker container

When sending an email as a non-root user from within a container, you may see an error like this:

postdrop: warning: mail_queue_enter: create file maildrop/354182.390: Permission denied

The problem is that the postdrop process running with your user privileges is trying to create a file inside var/spool/postfix/maildrop and failing. The reason it is failing is due to the setgid flag not being honoured on the postdrop binary.

You can chmod g+s /usr/sbin/postdrop all you like, it won't help.

The docker container needs the CAP_SETGID capability before this will work. Currently, the only way to get this is to run the container with all capabilities turned on (aka --privileged) but this is not generally a good idea for anything other than testing.

Docker issue #6687 should hopefully address this problem.

For now, a better solution is to chmod two directories in /var/spool/postfix as follows:

chmod o+rwx /var/spool/postfix/maildrop
chmod o+x /var/spool/postfix/public
@Jaykah
Copy link

Jaykah commented Aug 14, 2014

chmod o+rwx /var/spool/postfix/maildrop
chmod o+x /var/spool/postfix/public

Didn't work for me, what version did you test it on?

Thanks!

@porjo
Copy link
Author

porjo commented Sep 5, 2014

@Jaykah this is fixed as of Docker v1.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment