diff --git a/.changelog/11856.txt b/.changelog/11856.txt new file mode 100644 index 000000000..24a38b794 --- /dev/null +++ b/.changelog/11856.txt @@ -0,0 +1,3 @@ +```release-note:bug +drivers: Fixed a bug where the `resolv.conf` copied from the system was not readable to unprivileged processes within the task +``` diff --git a/drivers/shared/resolvconf/mount.go b/drivers/shared/resolvconf/mount.go index 02393478e..63954166c 100644 --- a/drivers/shared/resolvconf/mount.go +++ b/drivers/shared/resolvconf/mount.go @@ -69,15 +69,10 @@ func copySystemDNS(dest string) error { } defer in.Close() - out, err := os.Create(dest) + content, err := io.ReadAll(in) if err != nil { return err } - defer func() { - out.Sync() - out.Close() - }() - _, err = io.Copy(out, in) - return err + return os.WriteFile(dest, content, 0644) }