Initial email failure. Job exception: getaddrinfo: Name or service not known

I also got the same issue. But DOCKER_OPTS didn’t work for me.
I saw that

In the absence of the --dns=IP_ADDRESS…, --dns-search=DOMAIN…, or --dns-opt=OPTION… options, Docker uses the /etc/resolv.conf of the host machine (where the docker daemon runs).

So that was the problem for me. Our dns was not added to the host.