From 7531c66d5a4e9bf0674ee6d754107381e6075385 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Thu, 23 May 2019 22:03:56 +0000 Subject: [PATCH] Ensure that the rootfs dir is created in the bundle This fixes issues running gvisor on top of containerd without docker. Signed-off-by: Michael Crosby --- runtime/v1/linux/bundle.go | 4 ++++ runtime/v2/bundle.go | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/runtime/v1/linux/bundle.go b/runtime/v1/linux/bundle.go index 5be20f735..e8b629b79 100644 --- a/runtime/v1/linux/bundle.go +++ b/runtime/v1/linux/bundle.go @@ -65,6 +65,10 @@ func newBundle(id, path, workDir string, spec []byte) (b *bundle, err error) { os.RemoveAll(workDir) } }() + rootfs := filepath.Join(path, "rootfs") + if err := os.MkdirAll(rootfs, 0711); err != nil { + return nil, err + } err = ioutil.WriteFile(filepath.Join(path, configFilename), spec, 0666) return &bundle{ id: id, diff --git a/runtime/v2/bundle.go b/runtime/v2/bundle.go index 8c1673875..ad3e95bd3 100644 --- a/runtime/v2/bundle.go +++ b/runtime/v2/bundle.go @@ -79,6 +79,11 @@ func NewBundle(ctx context.Context, root, state, id string, spec []byte) (b *Bun if err := os.MkdirAll(filepath.Dir(work), 0711); err != nil { return nil, err } + rootfs := filepath.Join(b.Path, "rootfs") + if err := os.MkdirAll(rootfs, 0711); err != nil { + return nil, err + } + paths = append(paths, rootfs) if err := os.Mkdir(work, 0711); err != nil { if !os.IsExist(err) { return nil, err