pull/9756/head
Medya Gh 2020-11-20 15:47:02 -08:00
parent 301b24ab2e
commit 659e4ce1bd
1 changed files with 3 additions and 2 deletions

View File

@ -165,10 +165,10 @@ func isDockerActive(r command.Runner) bool {
return sysinit.New(r).Active("docker") return sysinit.New(r).Active("docker")
} }
// mustRestartDockerd will attemp to reload dockerd if fails, will try restart and exit if fails again // mustRestartDockerd will attempt to reload dockerd if fails, will try restart and exit if fails again
func mustRestartDockerd(name string, runner command.Runner) { func mustRestartDockerd(name string, runner command.Runner) {
// Docker Docs: https://docs.docker.com/config/containers/live-restore // Docker Docs: https://docs.docker.com/config/containers/live-restore
// On Linux, you can avoid a restart (and avoid any downtime for your containers) by reloading the Docker daemon. // On Linux, you can avoid a restart (and avoid any downtime for your containers) by reloading the Docker daemon.
klog.Warningf("dockerd is not active will try to reload it...") klog.Warningf("dockerd is not active will try to reload it...")
if err := sysinit.New(runner).Reload("docker"); err != nil { if err := sysinit.New(runner).Reload("docker"); err != nil {
klog.Warningf("will try to restart dockerd because reload failed: %v", err) klog.Warningf("will try to restart dockerd because reload failed: %v", err)
@ -256,6 +256,7 @@ var dockerEnvCmd = &cobra.Command{
out, err := tryDockerConnectivity("docker", ec) out, err := tryDockerConnectivity("docker", ec)
if err != nil { // docker might be up but been loaded with wrong certs/config if err != nil { // docker might be up but been loaded with wrong certs/config
// to fix issues like this #8185 // to fix issues like this #8185
// even though docker maybe running just fine it could be holding on to old certs and needs a refresh
klog.Warningf("couldn't connect to docker inside minikube. output: %s error: %v", string(out), err) klog.Warningf("couldn't connect to docker inside minikube. output: %s error: %v", string(out), err)
mustRestartDockerd(cname, co.CP.Runner) mustRestartDockerd(cname, co.CP.Runner)
} }