No, postfix is running directly on the host. I don’t think 25 is bound to the docker – at least, I didn’t bind it.
I can send mail via postfix (routing thru Gmail SMTP) from the host via mail command.
I’m just using the postfix that came with OSX. I built the ‘production’ version of mattermost team for OSX as in the wiki, using docker compose method.
Is the ‘production’ version where I have gone awry? I haven’t set up any nodes to interconnect – I just used that method to get a feature-parity OSX install.
Thanks for providing that extra info. From what I can see so far, it appears that your postfix installation is working fine, as you have reported that you can send emails through it directly. However, Mattermost is unable to talk to it because it can’t open the TCP connection to it, as reported by the error you posted.
According to the error message, Mattermost is trying to connect to the IP address 172.18.0.1 on port 25. Can you verify that your host system has that IP address on the “docker” network interface? And can you check that postfix is listening on that port on that IP address. I’m not familiar with OSX so I’m not sure exactly how you would check this. On Linux, you could run sudo ifconfig to check the first and sudo netstat -plnt for check the second - perhaps OSX is similar.
Possible issues I suspect might be the cause:
postfix is only listening on “localhost”, ie. 127.0.0.1. This means that the connection to it from the local mail command would work fine, as that connects to it locally, but the Mattermost container cannot connect to it because it is trying to reach it on the IP address 172.18.0.1.
(less likely than 1) Your docker network interface is listening on a different IP address thyan 172.18.0.1
I’ll have to recheck (docker not running atm; not at system), but I’m quite
sure that the IP address for docker interface is as it seems, 172.18.0.1.
How might I get postfix to listen on 172.18.0.1? Is there buried in postfix
cfg something to specify?
Actually, I think I did add the 172.18.0.0/16 (or /17 or whichever it is to
expand out to .255.255) subnet to the postfix config. I think that was just
for send mail permission though – Will need to check that also.
Or I suppose I could map 172.18.0.1:25 to local host:25 somehow…?
Not sure about how to configure postfix myself, but if you could paste the output of sudo netstat -plnt when you are back at the system that would allow us to confirm or rule out the listen address as the problem.
Ah, also, does that error mean mattermost is trying to send to 172.18.0.1, or is that just its from address? It’s not trying to open local host:25 / [::1]:25? (Which are the same, no?)
As you can tell, I’m not fluent in this stuff at all!
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d13b4599f2ba mattermostdocker_web “/bin/sh -c /docke…” 9 days ago Up 17 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp mattermostdocker_web_1
aba0c7a80380 mattermostdocker_app “/docker-entry.sh …” 9 days ago Up 17 minutes 80/tcp mattermostdocker_app_1
2b461e02d57d mattermostdocker_db “/docker-entrypoin…” 9 days ago Up 17 minutes 5432/tcp mattermostdocker_db_1
It seems getting OSX dockers to see the host is finnicky. There are other threads about how to access host services from OSX dockers, but I can’t seem to really understand.
If I built mattermost via docker-compose, how do I specify network settings, like -network=nat? Will have to understand this a bit better…!
Well your host service is listening on localhost aka 127.0.0.1 so no you won’t be able to connect, you need to make it listen to 10.200.10.1/24 given the link on your last message. That would create the ip 10.200.10.1 on the loopback giving it access to your docker.
Ofc in your case you most likely want the ip to be something like 172.18.0.1 or some other IP not in use.
On a previous message you said you were able to access the host at 192.168.100.101 so instead of doing the above steps you can just add that IP to your postfix config and configure mattermost smtp to use it and again do the telnet below to ensure you can connect.
Also you might need to ensure the firewall is not blocking access to/from those ports on both. Some times by default the firewall will be blocking it…
So ping -c1 host, if u get the pings you can reach it, then telnet host 25 or 587 depending on what you want…
I suspect that the ping test I posted above is bogus, because afterward I pinged all sorts of nonexistent addresses and all were successful, so long as the address was valid in form.
Is there anything in my docker’s hosts file that indicates that all addresses are forwarded back to the docker’s loopback?
Well, I am not familiar with docker so I can’t help you there, all I did was clear up the points related to postfix, based on what you have provided. In either case if you can issue a telnet host 25 from your docket and it doesn’t timeout, you’re green to go.
Hope it’s okay to revive this thread. I am running into the exact same problem as the original poster and I was wondering if @hayimd ended up finding a solution?
For those who stumble across this issue looking for a fix, here is what I did.
_I am assuming you have gone through the basic Mattermost Docker installation, and have set up Postfix as a regular service on your host machine.
On the host machine do ifconfig and find the ip address of the docker0 bridge network
In Mattermost’s system console set up email notifications as per the docs under ‘Postfix’, but enter the ip address from step 1 in stead of localhost.
Find the ip address of the mattermostdocker_web_1 container using this command: docker inspect -f '{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq)
Add the ip address from step 3 into /etc/postfix/main to mynetworks, save the file and make sure you do service postfix restart
Back in Mattermost, hit the ‘Test Connection’ button. The admin user should receive a test email from the configured from address.
I am no expert so I do not know if this is the ‘correct’ way to do this, but it works.