Why does virtual_transport = lmtp:dovecot:24 not work?
In your master.cf
, you have lmtp
configured to run in a chroot
environment:
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (no) (never) (100)
lmtp unix - - n - - lmtp
The chroot
environment doesn't have access to the container's /etc/resolv.conf
, so it doesn't know how to resolve hostnames. The lmtp configuration defaults to run in a chrooted environment because a typical configuration uses unix sockets to communicate, so hostname resolution isn't an issue.
The simplest fix is just to configure lmtp
to not run in chroot
environment:
lmtp unix - - y - - lmtp
With this change, mail is delivered correctly:
postfix_1 | Dec 16 21:47:15 8d74be7a5951 postfix/smtpd[598]: connect from unknown[172.28.0.1]
postfix_1 | Dec 16 21:47:15 8d74be7a5951 postfix/smtpd[598]: 9131638672DA: client=unknown[172.28.0.1]
postfix_1 | Dec 16 21:47:15 8d74be7a5951 postfix/qmgr[582]: 9131638672DA: from=<[email protected]>, size=434, nrcpt=1 (queue active)
postfix_1 | Dec 16 21:47:15 8d74be7a5951 postfix/smtpd[598]: disconnect from unknown[172.28.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
dovecot_1 | Dec 16 21:47:15 lmtp(16): Info: Connect from 172.28.0.3
dovecot_1 | Dec 16 21:47:15 lmtp([email protected])<16><+A19J2PnnGMQAAAAqj6rOA>: Info: msgid=<20221216164715.079491@rocket>: saved mail to INBOX
postfix_1 | Dec 16 21:47:15 8d74be7a5951 postfix/lmtp[597]: 9131638672DA: to=<[email protected]>, relay=dovecot[172.28.0.2]:24, delay=0.09, delays=0.07/0/0/0.01, dsn=2.0.0, status=sent (250 2.0.0 <[email protected]> +A19J2PnnGMQAAAAqj6rOA Saved)
dovecot_1 | Dec 16 21:47:15 lmtp(16): Info: Disconnect from 172.28.0.3: Logged out (state=READY)
postfix_1 | Dec 16 21:47:15 8d74be7a5951 postfix/qmgr[582]: 9131638672DA: removed
One alternative would be to configure a shared unix socket between the dovecot
and postfix
containers, and use that for communication rather than an inet connection.
A second alternative would be to run the lmtp container in the same network namespace as the postfix container, in which case you could simpler use the hostname localhost
.