juanluisbaptiste/docker-postfix

DNS connectivity issue

sigma2017 opened this issue · 3 comments

After starting a container from this image there is an issue related to DNS
I even put the right record in container /etc/hosts with no results
Out of the box is giving the same error as below but complains about ipv6 DNS (type=AAAA)
I can rebuild the image using inet_interfaces = ipv4 but I don't think it will help.

There is an issue related to resolver, the result is the same even i start the container with parameter --dns 8.8.8.8
postfix/smtp[120]: E05DB1A1220: to=xxx@gmail.com, relay=none, delay=5, delays=0.01/0.01/5/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=smtp.sendgrid.net type=A: Host not found, try again)

I have reloaded postfix inside container and when trying to send an email (through sendgrid) I get the above error.
Why this is happening since the domain is reachable?
``bash-5.1# nslookup smtp.sendgrid.net
Server: 8.8.8.8
Address: 8.8.8.8:53

Non-authoritative answer:
Name: smtp.sendgrid.net
Address: 54.228.39.88
Name: smtp.sendgrid.net
Address: 18.197.194.208
Name: smtp.sendgrid.net
Address: 52.57.139.126
Name: smtp.sendgrid.net
Address: 108.128.229.184

Non-authoritative answer:
``

I even started the container with the default bridge network, same result:

bash-5.1# nslookup smtp.sendgrid.net
Server: 172.17.18.1
Address: 172.17.18.1:53

Non-authoritative answer:
Name: smtp.sendgrid.net
Address: 108.128.229.184
Name: smtp.sendgrid.net
Address: 52.57.139.126
Name: smtp.sendgrid.net
Address: 54.228.39.88
Name: smtp.sendgrid.net
Address: 18.197.194.208

Non-authoritative answer:

Aug 10 08:50:35 metal postfix/smtp[107]: 009AC1A17CF: to=xxx@gmail.com, relay=none, delay=5, delays=0.01/0.01/5/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=smtp.sendgrid.net type=A: Host not found, try again)

This is beyond my understanding.

Can you please help?

Thanks in advance.

I found the issue, postfix reads the resolv.conf file from /var/spool/postfix/etc folder.
Even so, looks like this image doesn't have all the necessary modules like hash to send to sendgrid, already switched to another image which has everything, no need to build a custom image.
You may close the issue, sorry for the confusion.
Thank you.

I use sendgrid as my relay without issues, this image works fine with that SMTP provider.