minishift: RemoteHost install fails due to unprivileged docker version command
General information
- Minishift version: v1.29.0+72fa7b2
- OS: Linux
- Hypervisor: n/a (remote machine on AWS)
Steps to reproduce
- Set up remote machine according to https://docs.okd.io/latest/minishift/using/run-against-an-existing-machine.html#configuring-existing-remote-machine
- Ensure passwordless SSH using <user>
- Ensure <user> has passwordless SUDO rights on remote machine
- Run
minishift start --vm-driver generic --remote-ipaddress <remote_IP_address> --remote-ssh-user <username> --remote-ssh-key <private_ssh_key>
Expected
Minishift deploys OpenShift successfully remote machine. Specifically uses sudo when trying to run docker version --format '{{.Server.APIVersion}}'
Actual
Minishift fails with an error received when trying to run docker version --format '{{.Server.APIVersion}}' on the remote host:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.26/version: dial unix /var/run/docker.sock: connect: permission denied
This is due to the fact that /var/run/docker.sock is owned by root:root. It’s group is not docker nor wheel. Hence any calls to the docker CLI tool should be run via sudo. (see https://www.projectatomic.io/blog/2015/08/why-we-dont-let-non-root-users-run-docker-in-centos-fedora-or-rhel/)
Minishift attempts to run this command without sudo
Logs
-- Starting profile 'minishift'
-- Starting the OpenShift cluster using 'generic' hypervisor ...
-- Preparing Remote Machine ..... OK
-- Starting to provision the remote machine .......... OK
Error determining Docker settings: ssh command error:
command : docker version --format '{{.Server.APIVersion}}'
err : exit status 1
output :
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.26/version: dial unix /var/run/docker.sock: connect: permission denied
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 28 (20 by maintainers)
Commits related to this issue
- Issue #3124 Perform version check with sudo — committed to gbraad-redhat/minishift by gbraad 5 years ago
- Issue #3124 Add docker commands behind sudo — committed to praveenkumar/minishift by praveenkumar 5 years ago
- Issue #3124 Add docker and oc commands behind sudo We only need to put oc commands behind the sudo which we directly use inside the VM using `/var/lib/minishift/bin/oc` since once the clust... — committed to praveenkumar/minishift by praveenkumar 5 years ago
@dmesser sure that also can be done, and we need to move all our docker commands behind the
sudo.