Docker overrides my /etc/resolv.conf file inside containers

AFAIK, docker overrides some files in an image when it's started, even if they were ADDed in Dockerfile. This for sure includes /etc/hosts, and most probably the same happens for /etc/resolv.conf too. This is apparently used to properly build the default "internal" network of Docker (so that images see each other, but not host, etc.) If you are really sure you want to override/modify some of those files, I believe you must do that as part of the runtime actions, that is as part of the CMD line. For example:

...
ADD resolv.conf /etc/resolv.conf.override
CMD cp /etc/resolv.conf.override /etc/resolv.conf && \
        your_old_commands...

As I can see you are using user-defined networks and Docker Engine version >= 1.10. So from the official docker engine documentation about Embedded DNS server in user-defined networks:

These --dns IP addresses are managed by the embedded DNS server and will not be updated in the container's /etc/resolv.conf file.

Your dns has to work, but you will not see in any configuration file.

References.

Tags:

Docker