Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move root filesystem from rootfs to tmpfs #5133

Merged
merged 4 commits into from
Aug 26, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Only use DOCKER_RAMDISK on fstype rootfs
The docker configuration is determined at runtime,
so make it work with both old rootfs and new tmpfs.
  • Loading branch information
afbjorklund committed Aug 24, 2019
commit edea8f93a5b310c76cda13d4dddbaeb92fa8ae16
21 changes: 21 additions & 0 deletions pkg/provision/buildroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
afbjorklund marked this conversation as resolved.
Show resolved Hide resolved

engineConfigTmpl := `[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
Expand All @@ -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}}

Expand Down Expand Up @@ -160,6 +173,14 @@ WantedBy=multi-user.target
}, nil
}

func rootFileSystemType(p *BuildrootProvisioner) (string, error) {
fs, err := p.SSHCommand("df --output=fstype / | tail -n 1")
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
Expand Down