Issue with DNS Configuration on Rancher Docker on RHEL 7

Hello,

i am currently testing rancher in docker on RHEL 7 installed using

curl https://releases.rancher.com/install-docker/19.03.sh | sh

see docker-compose.yml below…

The rancher server running in docker container unfortuntly does not pick up the dns configuration of the host insted it is using googles 8.8.8.8. What is my best approche here? Map the host /etc/resolv.conf into the container? Use a custom resolv.conf? Change the coredns config? Is there a way to automatically let it pick the dns config from the host?

Checking upstream nameservers in resolv.conf

kubectl run -i --restart=Never --rm test-${RANDOM} --image=ubuntu --overrides=‘{“kind”:“Pod”, “apiVersion”:“v1”, “spec”: {“dnsPolicy”:“Default”}}’ – sh -c ‘cat /etc/resolv.conf’

Returns:

nameserver 8.8.8.8

Host

    > cat /etc/resolv.conf
    # Generated by NetworkManager#
    search corp.xxxxx.com
    nameserver 10.64.2.88
    nameserver 10.102.76.113

Racher Server in Container

    > cat /etc/resolv.conf 
    search cattle-system.svc.cluster.local svc.cluster.local cluster.local
    nameserver 10.43.0.10
    options ndots:5

the coredns config file looks like this…

 Corefile: |
    .:53 {
        errors
        health
        ready
        kubernetes cluster.local in-addr.arpa ip6.arpa {
          pods insecure
          upstream
          fallthrough in-addr.arpa ip6.arpa
        }
        hosts /etc/coredns/NodeHosts {
          reload 1s
          fallthrough
        }
        prometheus :9153
        forward . /etc/resolv.conf
        cache 30
        loop
        reload
        loadbalance
    }

docker-compose.yml

version: "3"


services:
  rancher:
    image: rancher/rancher:latest
    ports:
      - "80:80"
      - "443:443"
      - "1433:1433"
      - "8080:8080"
      - "5050:5050"
      - "9999:9999"
      - "6443:6443"
      - "8472:8472"
      - "10250:10250"
      - "2376:2376"
      - "2380:2380"
      - "9099:9099"
      - "10254:10254"

    restart: unless-stopped
    privileged: true
    dns:
      - 10.64.2.88
      - 10.102.76.113
    volumes:
      - /data/rancher:/var/lib/rancher