Skip to content

Commit

Permalink
Only add docker group for the docker runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
afbjorklund committed Jan 11, 2021
1 parent b2121ea commit 1663a03
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 7 additions & 0 deletions pkg/drivers/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
"net"
"os"
"os/exec"
"path"
"strconv"
"time"
Expand Down Expand Up @@ -124,6 +125,12 @@ func (d *Driver) Create() error {
}
}

if d.runtime.Name() == "Docker" {
if _, err := d.exec.RunCmd(exec.Command("sudo", "usermod", "-aG", "docker", d.GetSSHUsername())); err != nil {
return errors.Wrap(err, "usermod")
}
}

log.Debugf("IP: %s", d.IPAddress)

return nil
Expand Down
6 changes: 0 additions & 6 deletions pkg/minikube/machine/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,6 @@ func createHost(api libmachine.API, cfg *config.ClusterConfig, n *config.Node) (
return h, errors.Wrap(err, "post-start")
}

if driver.IsSSH(h.Driver.DriverName()) {
if _, err := h.RunSSHCommand(fmt.Sprintf("sudo usermod -aG docker %s", h.Driver.GetSSHUsername())); err != nil {
return h, errors.Wrap(err, "usermod")
}
}

if err := saveHost(api, h, cfg, n); err != nil {
return h, err
}
Expand Down

0 comments on commit 1663a03

Please sign in to comment.