create src dir for bind mounts

match docker behavior for bind mounts

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2017-06-01 16:09:39 +02:00
parent a28ed75e12
commit f3650533f0
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9

View file

@ -47,6 +47,10 @@ func addOciBindMounts(sb *sandbox, containerConfig *pb.ContainerConfig, specgen
return fmt.Errorf("Mount.HostPath is empty")
}
if _, err := os.Stat(src); err != nil && os.IsNotExist(err) {
os.MkdirAll(src, 0644)
}
options := []string{"rw"}
if mount.Readonly {
options = []string{"ro"}