From f3650533f031af3889a51011856f6b1f57bd6513 Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Thu, 1 Jun 2017 16:09:39 +0200 Subject: [PATCH] create src dir for bind mounts match docker behavior for bind mounts Signed-off-by: Antonio Murdaca --- server/container_create.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/container_create.go b/server/container_create.go index ca0ed788..263443bd 100644 --- a/server/container_create.go +++ b/server/container_create.go @@ -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"}