fix: Script exits fatally when resolv.conf is missing Docker nameserver (#1441)

pull/1442/head
Ambrose Chua 1 month ago committed by GitHub
parent 64e52360a8
commit 765da508a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      pkg/types/fixes/assets/k3d-entrypoint-dns.sh

@ -23,9 +23,7 @@ iptables-save \
| iptables-restore
# Update resolv.conf to use the Gateway IP if needed: this will also make CoreDNS use it via k3s' default `forward . /etc/resolv.conf` rule in the CoreDNS config
grep -q "${docker_dns}" /etc/resolv.conf
grepstatus=$?
if test $grepstatus -eq 0; then
if grep -q "${docker_dns}" /etc/resolv.conf; then
echo "[$(date -Iseconds)] [DNS Fix] > Replacing IP in /etc/resolv.conf ..."
cp /etc/resolv.conf /etc/resolv.conf.original
sed -e "s/${docker_dns}/${gateway}/g" /etc/resolv.conf.original >/etc/resolv.conf

Loading…
Cancel
Save