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

Stop docker daemon, when running cri-o #3211

Merged
merged 2 commits into from
Nov 15, 2018
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
Prev Previous commit
Disable docker-env output, if docker isn't running
Might be running an alternative container runtime
  • Loading branch information
afbjorklund committed Oct 3, 2018
commit f7df2dd6166d0116c80a5dbef1fc064ca7957983
14 changes: 14 additions & 0 deletions cmd/minikube/cmd/env.go
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ import (
"text/template"

"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/host"
"github.com/docker/machine/libmachine/shell"
"github.com/golang/glog"
"github.com/pkg/errors"
@@ -293,6 +294,14 @@ func (EnvNoProxyGetter) GetNoProxyVar() (string, string) {
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
var dockerEnvCmd = &cobra.Command{
Use: "docker-env",
@@ -315,6 +324,11 @@ var dockerEnvCmd = &cobra.Command{
fmt.Println(`'none' driver does not support 'minikube docker-env' command`)
os.Exit(0)
}
docker, err := GetDockerActive(host)
if !docker {
fmt.Println(`# The docker service is currently not active`)
os.Exit(1)
}

var shellCfg *ShellConfig