I'm trying to achieve this fun project of having multiple 'postfix/dovecot' instances inside a docker container.

I'm searching for 'something' that would redirect any incoming request on port 25 (any maybe later 143, 993) to the right container on a different port.

Here's the idea :

                        +-------+                    +----------+
(internet)----(port 25) |mainbox| ---- (port 52032)  |container1| (postfix)
                        +-------+  |                 +----------+
                                   \   (port 52033)  +----------+
                                                     |container2| (postfix)

So the idea is to 'redirect' requests coming to port 25 and based on 'hostname' to forward to the right port (internally); ideally, it would be great to manage this 'mapping' with a database/textfile

Any ideas ? Directions ?


You should use docker's ambassador containers and avoid hard linking between containers to ensure service portability. This will easily allow you to change your settings if you need to talk to a different or additional postfix container. You simply restart the postfix-ambassador container that your mail box is connected to. In the case of mail processing where you might want to add various other processing stages, e.g. SpamAssassin, ClamAV, etc., this approach will help in creating a chained process.

This pattern supports the moving of your postfix server to a different docker host.

Here is a blog post describing the pattern - http://fosiki.com/blog/2013/12/05/docker-container-network-portability/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.