It is a 17.10 host with systemd-resolved. The host returns the same thing:
$ host nowhere.invalid
Host nowhere.invalid not found: 2(SERVFAIL)
The container is 16.04 and it has the typical setup of having /etc/resolv.conf point to the gateway’s dnsmasq that is running on the host, which uses the host’s /etc/resolv.conf, which points at the host’s systemd-resolved. Ie, should be nothing out of the ordinary for a 17.10 host running 16.04 containers.
I can reproduce the failure on my artful system. It looks like dnsmasq and systemd-resolved is the culprit. systemd-resolved has special code to return .invalid tld to comply to rfc6761. It returns no-servers in this case which gets translated to SERVFAIL which go considers a temporary error. So our code retries instead of failing. A simple workaround is pushed to https://github.com/snapcore/snapd/pull/4361