diff --git a/pkg/cri/opts/container.go b/pkg/cri/opts/container.go index 5a4c94b88e51..cc5e366148aa 100644 --- a/pkg/cri/opts/container.go +++ b/pkg/cri/opts/container.go @@ -66,6 +66,12 @@ func WithVolumes(volumeMounts map[string]string) containerd.NewContainerOpts { if err != nil { return err } + // Since only read is needed, append ReadOnly mount option to prevent linux kernel + // from syncing whole filesystem in umount syscall. + if len(mounts) == 1 && mounts[0].Type == "overlay" { + mounts[0].Options = append(mounts[0].Options, "ro") + } + root, err := ioutil.TempDir("", "ctd-volume") if err != nil { return err