Merge pull request #536 from ibuildthecloud/master

rootless: fix mounting /var/lib/cni
This commit is contained in:
Erik Wilson 2019-06-14 13:47:35 -07:00 committed by GitHub
commit 32283aa8e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -42,13 +42,17 @@ func setupMount(target, dir string) error {
toCreate = filepath.Base(toCreate)
}
if err := os.MkdirAll(toCreate, 0700); err != nil {
return errors.Wrapf(err, "failed to create directory %s", toCreate)
}
logrus.Debug("Mounting none ", toCreate, " tmpfs")
if err := unix.Mount("none", toCreate, "tmpfs", 0, ""); err != nil {
return errors.Wrapf(err, "failed to mount tmpfs to %s", toCreate)
}
if err := os.MkdirAll(target, 0700); err != nil {
return errors.Wrapf(err, "failed to create directory %s")
return errors.Wrapf(err, "failed to create directory %s", target)
}
if dir == "" {
@ -56,7 +60,7 @@ func setupMount(target, dir string) error {
}
if err := os.MkdirAll(dir, 0700); err != nil {
return errors.Wrapf(err, "failed to create directory %s")
return errors.Wrapf(err, "failed to create directory %s", dir)
}
logrus.Debug("Mounting ", dir, target, " none bind")

View File

@ -128,7 +128,7 @@ func createChildOpt() (*child.Opt, error) {
opt.PipeFDEnvKey = pipeFD
opt.NetworkDriver = slirp4netns.NewChildDriver()
opt.PortDriver = portbuiltin.NewChildDriver(&logrusDebugWriter{})
opt.CopyUpDirs = []string{"/etc", "/run"}
opt.CopyUpDirs = []string{"/etc", "/run", "/var/lib"}
opt.CopyUpDriver = tmpfssymlink.NewChildDriver()
return opt, nil
}