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

Skip containerd shutdown if Docker is bound to it #7595

Merged
merged 1 commit into from
Apr 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions pkg/minikube/cruntime/cruntime.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ func ContainerStatusCommand() string {

// disableOthers disables all other runtimes except for me.
func disableOthers(me Manager, cr CommandRunner) error {

// valid values returned by manager.Name()
runtimes := []string{"containerd", "crio", "docker"}
for _, name := range runtimes {
Expand All @@ -178,13 +179,22 @@ func disableOthers(me Manager, cr CommandRunner) error {
if r.Name() == me.Name() {
continue
}

// Don't disable containerd if we are bound to it
if me.Name() == "Docker" && r.Name() == "containerd" && dockerBoundToContainerd(cr) {
medyagh marked this conversation as resolved.
Show resolved Hide resolved
glog.Infof("skipping containerd shutdown because we are bound to it")
continue
}

// runtime is already disabled, nothing to do.
if !r.Active() {
continue
}

if err = r.Disable(); err != nil {
glog.Warningf("disable failed: %v", err)
}

// Validate that the runtime really is offline - and that Active & Disable are properly written.
if r.Active() {
return fmt.Errorf("%s is still active", r.Name())
Expand Down
15 changes: 15 additions & 0 deletions pkg/minikube/cruntime/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,3 +364,18 @@ func DockerImagesPreloaded(runner command.Runner, images []string) bool {
}
return true
}

func dockerBoundToContainerd(runner command.Runner) bool {
// NOTE: assumes systemd
rr, err := runner.RunCmd(exec.Command("sudo", "systemctl", "cat", "docker.service"))
if err != nil {
glog.Warningf("unable to check if docker is bound to containerd")
return false
}

if strings.Contains(rr.Stdout.String(), "\nBindsTo=containerd") {
return true
}

return false
}