diff --git a/pkg/provision/buildroot.go b/pkg/provision/buildroot.go index 9baa3791ca35..94c8b93e5d9b 100644 --- a/pkg/provision/buildroot.go +++ b/pkg/provision/buildroot.go @@ -92,6 +92,13 @@ func (p *BuildrootProvisioner) GenerateDockerOptions(dockerPort int) (*provision driverNameLabel := fmt.Sprintf("provider=%s", p.Driver.DriverName()) p.EngineOptions.Labels = append(p.EngineOptions.Labels, driverNameLabel) + noPivot := true + // Using pivot_root is not supported on fstype rootfs + if fstype, err := rootFileSystemType(p); err == nil { + log.Debugf("root file system type: %s", fstype) + noPivot = fstype == "rootfs" + } + engineConfigTmpl := `[Unit] Description=Docker Application Container Engine Documentation=https://docs.docker.com @@ -101,8 +108,14 @@ Requires= minikube-automount.service docker.socket [Service] Type=notify +` + if noPivot { + engineConfigTmpl += ` # DOCKER_RAMDISK disables pivot_root in Docker, using MS_MOVE instead. Environment=DOCKER_RAMDISK=yes +` + } + engineConfigTmpl += ` {{range .EngineOptions.Env}}Environment={{.}} {{end}} @@ -160,6 +173,14 @@ WantedBy=multi-user.target }, nil } +func rootFileSystemType(p *BuildrootProvisioner) (string, error) { + fs, err := p.SSHCommand("stat --file-system --format '%T' /") + if err != nil { + return "", err + } + return strings.TrimSpace(fs), nil +} + // Package installs a package func (p *BuildrootProvisioner) Package(name string, action pkgaction.PackageAction) error { return nil