Shortcut read-only bind-mounts in Windows, like non-Windows

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
v0.8
Paul "TBBle" Hampson 2020-07-23 23:04:24 +10:00
parent 11a8e7216a
commit 4e69b50469
1 changed files with 13 additions and 0 deletions

View File

@ -25,6 +25,19 @@ func (lm *localMounter) Mount() (string, error) {
return "", errors.Wrapf(errdefs.ErrNotImplemented, "request to mount %d layers, only 1 is supported", len(lm.mounts))
}
if lm.mounts[0].Type == "bind" || lm.mounts[0].Type == "rbind" {
ro := false
for _, opt := range lm.mounts[0].Options {
if opt == "ro" {
ro = true
break
}
}
if !ro {
return lm.mounts[0].Source, nil
}
}
// Windows mounts always activate in-place, so the target of the mount must be the source directory.
// See https://github.com/containerd/containerd/pull/2366
dir := lm.mounts[0].Source