Select specific outbound IP for Container traffic

Hi there :slight_smile: i’m new here and hope this goes in the right category

My Docker-host has two public IPs:

A) xx.xx.xx.143
B) xx.xx.xx.139

I use interface A for my reverse-proxy and websites and would like to use Interface B for sending out my mails.

So i just set up a postfix Container with docker-compose with the following file:

version: "3"
    image: postfix
  - "xx.xx.xx.139:25:25"
  - "xx.xx.xx.139:465:465"
  - "xx.xx.xx.139:587:587"
  - ./
  - mail

While this configuration works well for incoming traffic (i can connect to the Mailserver over Interface B) it doesn’t work as i want for outgoing Mails.

Don’t get me wrong i can send mails and they get delivered but as i can see in the Header of the mail they will be sent from IP xx.xx.xx.143 – Interface A

Any idea how i can force this container to send the mails out over Interface B?

Docker-Engine Version: 18.03.0-ce
Docker-API Version: 1.37
Docker-compose Version: 1.20.1

Thanks in advance :slight_smile: