配置 coredns

shell复制
mkdir -p /data/coredns
vi /data/coredns/Corefile
shell复制
.:53 {

    hosts {
        10.97.111.111 baidu.com
        10.97.111.111 google.com
        fallthrough
    }

    forward . 223.5.5.5 8.8.8.8
    cache 30
    log
}

启动 coredns

shell复制
docker run -d \
  --name coredns \
  --restart=always \
  --network host \
  -v /data/coredns/Corefile:/Corefile \
  coredns/coredns -conf /Corefile

测试解析

shell复制
nslookup baidu.com 127.0.0.1