The above solution for me is NOT the best.I would like to suggest a solution much easier and with absolutely no editing in any docker-compose.yml.
In /etc/resolvconf.conf you just need to enable:
nameserver 127.0.0.1
... as written in this file itself:
# If you run a local name server, you should uncomment the below line and
# configure your subscribers configuration files below.
After this just do a
sudo resolvconf -u
to update the reslove-config. .. and of course redeploy your containers.