snapshot/overlay: use readonly bindmount for single parent view

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
Derek McGowan 2017-02-27 13:21:20 -08:00
parent 1723444ba2
commit eeb88554ac
2 changed files with 49 additions and 3 deletions

View file

@ -330,6 +330,17 @@ func (a *activeDir) mounts(c *cache) ([]containerd.Mount, error) {
)
} else if !os.IsNotExist(err) {
return nil, err
} else if len(parents) == 1 {
return []containerd.Mount{
{
Source: parents[0],
Type: "bind",
Options: []string{
"ro",
"rbind",
},
},
}, nil
}
options = append(options, fmt.Sprintf("lowerdir=%s", strings.Join(parents, ":")))