Container uses 8.8.8.8 for DNS resolution

Author: BradStatonCreated Jun 3, 2026Updated Aug 9, 2026

Description

The container's /etc/resolv.conf has Google's Public DNS (8.8.8.8) hard-coded for DNS resolution. This prevents the container from using DNS resolvers on the local network (or, in my case in a k8s cluster) from being used.

Steps to recreate

  1. Open a shell in the container
  2. Run an nslookup command
  3. Results show that nameserver at 8.8.8.8 is being used for resolution
bash
/app # nslookup www.example.com
Server:         8.8.8.8
Address:        8.8.8.8:53

Non-authoritative answer:
Name:   www.example.com
Address: 172.66.147.243
Name:   www.example.com
Address: 104.20.23.154

Non-authoritative answer:
Name:   www.example.com
Address: 2606:4700:10::6814:179a
Name:   www.example.com
Address: 2606:4700:10::ac42:93f3

Expected results

Container should use Docker host's or k8s cluster's DNS config.