Stop docker daemon, when running cri-o (#3211)
* Stop extra container runtimes, before bootstrapper The minikube.iso starts every runtime, by default * Disable docker-env output, if docker isn't running Might be running an alternative container runtimepull/3346/head
parent
2ceec0d084
commit
b69fc99d62
|
@ -26,6 +26,7 @@ import (
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/docker/machine/libmachine"
|
"github.com/docker/machine/libmachine"
|
||||||
|
"github.com/docker/machine/libmachine/host"
|
||||||
"github.com/docker/machine/libmachine/shell"
|
"github.com/docker/machine/libmachine/shell"
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -293,6 +294,14 @@ func (EnvNoProxyGetter) GetNoProxyVar() (string, string) {
|
||||||
return noProxyVar, noProxyValue
|
return noProxyVar, noProxyValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetDockerActive(host *host.Host) (bool, error) {
|
||||||
|
statusCmd := `sudo systemctl is-active docker`
|
||||||
|
status, err := host.RunSSHCommand(statusCmd)
|
||||||
|
// systemd returns error code on inactive
|
||||||
|
s := strings.TrimSpace(status)
|
||||||
|
return err == nil && s == "active", err
|
||||||
|
}
|
||||||
|
|
||||||
// envCmd represents the docker-env command
|
// envCmd represents the docker-env command
|
||||||
var dockerEnvCmd = &cobra.Command{
|
var dockerEnvCmd = &cobra.Command{
|
||||||
Use: "docker-env",
|
Use: "docker-env",
|
||||||
|
@ -315,6 +324,11 @@ var dockerEnvCmd = &cobra.Command{
|
||||||
fmt.Println(`'none' driver does not support 'minikube docker-env' command`)
|
fmt.Println(`'none' driver does not support 'minikube docker-env' command`)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
docker, err := GetDockerActive(host)
|
||||||
|
if !docker {
|
||||||
|
fmt.Println(`# The docker service is currently not active`)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
var shellCfg *ShellConfig
|
var shellCfg *ShellConfig
|
||||||
|
|
||||||
|
|
|
@ -292,6 +292,31 @@ func runStart(cmd *cobra.Command, args []string) {
|
||||||
cmdutil.MaybeReportErrorAndExit(err)
|
cmdutil.MaybeReportErrorAndExit(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println("Stopping extra container runtimes...")
|
||||||
|
|
||||||
|
containerRuntime := viper.GetString(containerRuntime)
|
||||||
|
if config.VMDriver != "none" && containerRuntime != "" {
|
||||||
|
if _, err := host.RunSSHCommand("sudo systemctl stop docker"); err == nil {
|
||||||
|
_, err = host.RunSSHCommand("sudo systemctl stop docker.socket")
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
glog.Errorf("Error stopping docker", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if config.VMDriver != "none" && (containerRuntime != "crio" && containerRuntime != "cri-o") {
|
||||||
|
if _, err := host.RunSSHCommand("sudo systemctl stop crio"); err != nil {
|
||||||
|
glog.Errorf("Error stopping crio", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if config.VMDriver != "none" && containerRuntime != "rkt" {
|
||||||
|
if _, err := host.RunSSHCommand("sudo systemctl stop rkt-api"); err == nil {
|
||||||
|
_, err = host.RunSSHCommand("sudo systemctl stop rkt-metadata")
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
glog.Errorf("Error stopping rkt", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fmt.Println("Starting cluster components...")
|
fmt.Println("Starting cluster components...")
|
||||||
|
|
||||||
if !exists || config.VMDriver == "none" {
|
if !exists || config.VMDriver == "none" {
|
||||||
|
|
Loading…
Reference in New Issue