We use MUP to deploy our Meteor app, NYBR. MUP creates three docker containers for running the meteor app, nginx reverse proxy and mongo. Like most applications, the need for sending the email came, ideally we should be using Amazon Web Services SES, but getting their approval was pain in the @$$ and was taking time. So, we did not want to hold back our development and decided to send the email through our own SMTP server until SES was approved.
We installed postfix and were hoping to get to developing and sending beautiful email to our users. Unfortunately we were greeted with the Connection refused error.
After trying various things in post fix configuration at
/etc/postfix/main.cf, turns out there is something called docker bridge (docker0) which acts a a bridge between your ethernet port and docker containers so that data can go back and forth.
So you have to listen on the docker0 interface. Todo that, type
ifconfig on your host system to find out the bridge address and set your postfix to listen on it.
As you can see in the image above, the ip is 172.17.0.1
In post fix cons located at set
inet_interfaces = 172.17.0.1
While you are there, add your actual docker container ip address to mynetworks
mynetworks = 172.17.0.3 172.17.0.5
above two are private ip addresses of my docker containers from which I wish to send email.
You can find the IP address of your docker container by
docker inspect [container_id, container_name]
docker inspect my_container_name
Let me know in comments if you would like to learn how to send html emails in meteor.