Dockerfile-based solution
You can also fix the DNS lookup problem on a per RUN
-command level:
RUN echo "nameserver XX.XX.1.1" > /etc/resolv.conf && \
echo "search companydomain" >> /etc/resolv.conf && \
command_depending_on_dns_resolution
Keep in mind: This will only change the DNS resolution behaviour for this one RUN
command, as changes to the /etc/resolv.conf
are not persistent (I could not find any official reference for this behaviour beside from a comment from of one of the core Docker engineers Brian Goff).