vps從snap恢復數據之後,發現dns有問題,導致docker pull用不了。
ubuntu 18.04上,/etc/resolv.conf 是 /run/systemd/resolve/stub-resolv.conf的一個軟連接。
定位到問題的本質是:/run/systemd/resolve/文件夾不存在。
解決辦法:
mkdir /run/systemd/resolve/
touch /run/systemd/resolve/stub-resolv.conf
sudo rm /etc/resolv.conf
sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
echo "nameserver 8.8.8.8" > /etc/resolv.conf