Reputation: 3606
When trying to start minikube with docker driver, as a root user I get:
$ minikube start --driver=docker
* minikube v1.16.0 on Ubuntu 18.04
* Using the docker driver based on user configuration
* 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/
X Exiting due to DRV_AS_ROOT: The "docker" driver should not be used with root privileges.
What is the problem to use docker driver as a root user?
Upvotes: 21
Views: 32785
Reputation: 764
This is a question of security. In official docker documentation written clearly about the risks.
As per documentation -
Docker allows you to share a directory between the Docker host and a guest container; and it allows you to do so without limiting the access rights of the container. This means that you can start a container where the /host directory is the / directory on your host; and the container can alter your host filesystem without any restriction.
adduser newUser
usermod -aG sudo newUser
su - newUser
su - newUser
sudo groupadd docker
sudo usermod -aG docker $USER
After logging in to that user with su -
, we need to run the following command as well:
sudo usermod -aG docker $USER && newgrp docker
minikube start --driver=docker
docker ps
Here is a github issue you may have a look.
This steps will solve the error you were facing when you were trying to start minikube. But this steps won't solve the security issues because docker group grants privileges equivalent to the root user. To run docker without root privilege aka rootless mode you need to follow this documentation.
Upvotes: 30
Reputation: 404
Using docker driver with root privileges has potential security issues. To manage Docker as a non-root user, do:
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
For details seeing the official documentation.
Upvotes: 0
Reputation: 121
It works for me by executing the line:
minikube start --force
Upvotes: 6
Reputation: 731
Which User are you using now? Type on the terminal.
whoami
or
echo $USER
Then you can see your username. But This is not mandatory.
Just Add the User to the Docker Group with below cmd
sudo usermod -aG docker $USER
Upvotes: 0
Reputation: 339
Login to root user and run below commands.
useradd testuser
usermod -aG docker testuser
su - testuser (or open another terminal and login to testuser)
minikube start --driver=docker
its works!
Upvotes: 4