From a48a062d8e16a06d9f83edb8f51edea5dd120ad8 Mon Sep 17 00:00:00 2001 From: Shukui Yang Date: Mon, 31 Aug 2020 19:42:21 +0800 Subject: [PATCH] network: Fix Could not create destination mount point: /etc/resolv.conf agent does not check if /etc/resolv.conf exists, if it does not exist, setDns will fail and causes the container to fail to run. sometimes,we don't need dns in guest vm, so it's better to skip and return nil if /etc/resolv.conf does not exists. Fixes: #829 Signed-off-by: Shukui Yang --- network.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/network.go b/network.go index 59b93d572b..0a73152585 100644 --- a/network.go +++ b/network.go @@ -693,6 +693,11 @@ func setupDNS(dns []string) (err error) { return nil } + if _, err := os.Stat(guestDNSFile); err != nil && os.IsNotExist(err) { + agentLog.Errorf("%s is not exist in guest, dns service may be unavailable", guestDNSFile) + return nil + } + if err := os.MkdirAll(filepath.Dir(kataGuestSandboxDNSFile), 0700); err != nil { return err }