Postfix in Docker: Host or domain name not found (DNS and Docker)

Postfix runs several processes with a chroot to /var/spool/postfix. This means that system-files, like /etc/resolv.conf for DNS resolving, should be found at /var/spool/postfix/etc/resolv.conf.

In order to get it working, I had to copy this file to the correct location during startup:

CMD cp /etc/resolv.conf /var/spool/postfix/etc/resolv.conf && postfix start-fg

WARNING: Do not copy it during the build, because you may end up with a resolv.conf of your build-server in stead of a resolv.conf of your production-server.