Redirect 'host-based' requests to a port (inside a docker container)

Posted by Disco on Super User See other posts from Super User or by Disco
Published on 2013-11-12T15:45:22Z Indexed on 2013/11/12 15:54 UTC
Read the original article Hit count: 325

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 ?

© Super User or respective owner

Related posts about port-forwarding

Related posts about postfix