Is it ok to remove 127.0.0.1 from /etc/resolv.conf

I am having problems with my docker container which keeps losing connection to the internet - and it is suggested to edit /etc/resolv.conf from the host in order to use external dns.

Currently my resolv.conf reads:

nameserver 127.0.0.1 nameserver 213.133.98.98 nameserver 213.133.99.99 nameserver 213.133.100.100 nameserver 2a01:4f8:0:a0a1::add:1010 nameserver 2a01:4f8:0:a111::add:9898 nameserver 2a01:4f8:0:a102::add:9999

Is it safe for me to remove the first line? Will removing it cause anything to break? (I guess the other nameserver entries were added by my dedicated server provider.)

Keep first line you need it, but you can add google dns: 8.8.8.8 and 8.8.4.4.

Thanks Diabolico - apologies for not coming back sooner to say thanks!

I did try this, but unfortunately it didn’t help the Docker issue - which seems to be related to the CSF firewall I am running. (Docker adds some rules then CSF seems to wipe them periodically).

Thanks Diabolico - apologies for not coming back sooner to say thanks!

I did try this, but unfortunately it didn’t help the Docker issue - which seems to be related to the CSF firewall I am running. (Docker adds some rules then CSF seems to wipe them periodically).

Never used CSF but what i know it should be a software for advanced firewall management plus some extra on top of that. Not sure if you really need CSF but you could try to disable/remove and go back to classic iptables and for security use fail2ban. If your firewall still gets changed it could be that your host provider is doing this, e.g. changing the rules after each server restart.