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

The "docker" driver should not be used with root privileges. #7903

Closed
bhushankummar opened this issue Apr 25, 2020 · 16 comments
Closed

The "docker" driver should not be used with root privileges. #7903

bhushankummar opened this issue Apr 25, 2020 · 16 comments
Labels
co/docker-driver Issues related to kubernetes in container kind/support Categorizes issue or PR as a support question. triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@bhushankummar
Copy link

Steps to reproduce the issue:

minikube start --driver=docker
  1. Execute above command and you will see the error.

Full output of failed command:

root@fst-server-3-ubuntu-2gb-fsn1-1:~/faas-netes# minikube start --driver=docker --alsologtostderr
I0425 09:34:48.887475   24566 notify.go:125] Checking for updates...
I0425 09:34:48.999024   24566 start.go:262] hostinfo: {"hostname":"fst-server-3-ubuntu-2gb-fsn1-1","uptime":147613,"bootTime":1587652475,"procs":176,"os":"linux","platform":"ubuntu","platformFamily":"debian","platformVersion":"18.04","kernelVersion":"4.15.0-96-generic","virtualizationSystem":"","virtualizationRole":"","hostid":"0a8bb66d-63f8-47b9-b95e-6bb3ce32e001"}
I0425 09:34:48.999713   24566 start.go:272] virtualization:  
😄  minikube v1.9.2 on Ubuntu 18.04
I0425 09:34:49.001356   24566 driver.go:245] Setting default libvirt URI to qemu:///system
✨  Using the docker driver based on user configuration
I0425 09:34:49.140369   24566 start.go:310] selected driver: docker
I0425 09:34:49.140388   24566 start.go:656] validating driver "docker" against <nil>
I0425 09:34:49.140411   24566 start.go:662] status for docker: {Installed:true Healthy:true Error:<nil> Fix: Doc:}
I0425 09:34:49.140448   24566 start.go:1100] auto setting extra-config to "kubeadm.pod-network-cidr=10.244.0.0/16".
🛑  The "docker" driver should not be used with root privileges.
💡  If you are running minikube within a VM, consider using --driver=none:
📘    https://minikube.sigs.k8s.io/docs/reference/drivers/none/
root@fst-server-3-ubuntu-2gb-fsn1-1:~/faas-netes# 

Full output of minikube start command used, if not already included:

root@fst-server-3-ubuntu-2gb-fsn1-1:~/faas-netes# minikube start
😄  minikube v1.9.2 on Ubuntu 18.04
✨  Automatically selected the docker driver
🛑  The "docker" driver should not be used with root privileges.
💡  If you are running minikube within a VM, consider using --driver=none:
📘    https://minikube.sigs.k8s.io/docs/reference/drivers/none/
root@fst-server-3-ubuntu-2gb-fsn1-1:~/faas-netes# 
@medyagh
Copy link
Member

medyagh commented Apr 26, 2020

@bhushankumarl running minikube with root user is not allowed, please create a new user, and run it with that user

make sure add that user to the docker group.
https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user

@medyagh medyagh added kind/support Categorizes issue or PR as a support question. triage/needs-information Indicates an issue needs more information in order to work on it. labels Apr 26, 2020
@afbjorklund afbjorklund added the co/docker-driver Issues related to kubernetes in container label Apr 26, 2020
@bhushankummar
Copy link
Author

@medyagh @afbjorklund
Looks working. Thank You.

Here is the fix to make it quick.

Add new User

adduser developer
# password@7
usermod -aG sudo developer
su - developer

Login to the newly created User

su - developer
# password@7

Add User to the Docker Group

sudo groupadd docker
sudo usermod -aG docker $USER
- Re-Login or Restart the Server

Install Minicube

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube
mv ./minikube /usr/local/bin/minikube

Start minikube with Docker Driver

minikube start --driver=docker

Verify minikube Installation

docker ps

@mdmustafa1
Copy link

it worked for me, used above command

@abyssinian-wolf
Copy link

abyssinian-wolf commented Dec 9, 2020

do not run the "minikube start" command with a root (sudo) privilege.
just run without root privilege.
this worked for me

@lizheray
Copy link

if you use Linux Desktop OS with docker and minikube already installed, just run

sudo usermod -aG docker $USER

and restart your computer.
It worked for me.

@mvolfik
Copy link

mvolfik commented Jan 28, 2021

I installed minikube as debian package: (from https://minikube.sigs.k8s.io/docs/start/)

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
sudo dpkg -i minikube_latest_amd64.deb

However, /usr/bin/minikube was set with these permissions:

-rwxr-x--- 1 root root 58M led 25 18:40 /usr/bin/minikube*

Meaning only root could execute it. I fixed that by sudo chown :docker /usr/bin/minikube (allow executing by users in group docker)

@afbjorklund
Copy link
Collaborator

@mvolfik : that is unrelated to this issue, it was just a packaging error with the revision 2 (unfortunately) - it should be 755

@ica10888
Copy link

I just run command sudo usermod -aG docker $USER && newgrp docker on Ubuntu , and it worked.
Could see more details in this document manage-docker-as-a-non-root-user

@anigkus
Copy link

anigkus commented Aug 29, 2021

this okay:


[root@centos-linux-minikube ~]# useradd -u 1024 -g docker docker
[root@centos-linux-minikube ~]# passwd docker
Changing password for user docker.
New password: 
BAD PASSWORD: The password is shorter than 8 characters
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@centos-linux-minikube ~]# su docker
[docker@centos-linux-minikube root]$ 
[docker@centos-linux-minikube root]$ 
[docker@centos-linux-minikube root]$ minikube start
* minikube v1.22.0 on Centos 7.9.2009 (amd64)
* Automatically selected the docker driver
* Starting control plane node minikube in cluster minikube
* Pulling base image ...
* Downloading Kubernetes v1.21.2 preload ...
    > preloaded-images-k8s-v11-v1...: 502.14 MiB / 502.14 MiB  100.00% 8.06 MiB
    > index.docker.io/kicbase/sta...: 361.09 MiB / 361.09 MiB  100.00% 710.58 K
    > index.docker.io/kicbase/sta...: 361.09 MiB / 361.09 MiB  100.00% 341.77 K
! minikube was unable to download gcr.io/k8s-minikube/kicbase:v0.0.25, but successfully downloaded kicbase/stable:v0.0.25 as a fallback image
* Creating docker container (CPUs=2, Memory=2200MB) ...
! This container is having trouble accessing https://k8s.gcr.io
* To pull new external images, you may need to configure a proxy: https://minikube.sigs.k8s.io/docs/reference/networking/proxy/
* Preparing Kubernetes v1.21.2 on Docker 20.10.7 ...
  - Generating certificates and keys ...
  - Booting up control plane ...
  - Configuring RBAC rules ...
* Verifying Kubernetes components...
  - Using image gcr.io/k8s-minikube/storage-provisioner:v5
* Enabled addons: default-storageclass, storage-provisioner
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
[docker@centos-linux-minikube root]$ kubectl get po -A
NAMESPACE     NAME                               READY   STATUS    RESTARTS   AGE
kube-system   coredns-558bd4d5db-zxzht           1/1     Running   0          42s
kube-system   etcd-minikube                      1/1     Running   0          53s
kube-system   kube-apiserver-minikube            1/1     Running   0          53s
kube-system   kube-controller-manager-minikube   1/1     Running   0          53s
kube-system   kube-proxy-v8xtz                   1/1     Running   0          42s
kube-system   kube-scheduler-minikube            1/1     Running   0          57s
kube-system   storage-provisioner                1/1     Running   0          52s

@subodhkumar95340
Copy link

Follow this command
It will resolve your issue

sudo -E minikube start --driver=none

sudo minikube config set driver none

minikube start

@afbjorklund
Copy link
Collaborator

You don't need to run minikube with sudo.

@mirarifhasan
Copy link

mirarifhasan commented Mar 9, 2022

Another way I found from Docker forums without creating any new user.

Just run the following CMD:
minikube start --force --driver=docker

This worked for me in Ubuntu machine.

@AvikantSrivastava
Copy link

sudo chmod 666 /var/run/docker.sock

Give permission to the docker socket, and minikube should work as expected

@Sigty
Copy link

Sigty commented May 16, 2022

sudo usermod -aG docker $USER && newgrp docker - easy way to add permissions for our user.

@ling0900
Copy link

thanks

@ViaDroid
Copy link

ViaDroid commented Nov 7, 2024

Env: Ubuntu 22.04 on Virtual-Box
Docker installed
Minikube installed

Got error:

$ minikube start
😄  minikube v1.34.0 on Ubuntu 22.04
✨  Using the docker driver based on user configuration
🛑  The "docker" driver should not be used with root privileges. If you wish to continue as root, use --force.
💡  If you are running minikube within a VM, consider using --driver=none:
📘    https://minikube.sigs.k8s.io/docs/reference/drivers/none/

Then

sudo usermod -aG docker $USER && newgrp docker

minikube start

Problem solved~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
co/docker-driver Issues related to kubernetes in container kind/support Categorizes issue or PR as a support question. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests