-2

I have installed Kubernetes and Minikube on NixOS 22.05. But I can't start Kubernetes:

minikube start --driver=docker

Output:

  minikube v1.25.2 on Nixos 22.05 (Quokka)
    ▪ MINIKUBE_WANTUPDATENOTIFICATION=false
✨  Using the docker driver based on user configuration

  Exiting due to PROVIDER_DOCKER_NEWGRP: "docker version --format -" exit status 1: 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.24/version": dial unix /var/run/docker.sock: connect: permission denied
  Suggestion: Add your user to the 'docker' group: 'sudo usermod -aG docker $USER && newgrp docker'
  Documentation: https://docs.docker.com/engine/install/linux-postinstall/

I followed the suggestion to add me to group docker:

sudo groupadd docker

Output:

[sudo] password for t:
groupadd: group 'docker' already exists

And:

sudo gpasswd -a $USER docker

Output:

Adding user t to group docker

And:

newgrp docker

But it still doesn't work:

minikube start --driver=docker

Output:

  minikube v1.25.2 on Nixos 22.05 (Quokka)
    ▪ MINIKUBE_WANTUPDATENOTIFICATION=false
✨  Using the docker driver based on user configuration

  Exiting due to PROVIDER_DOCKER_NEWGRP: "docker version --format -" exit status 1: 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.24/version": dial unix /var/run/docker.sock: connect: permission denied
  Suggestion: Add your user to the 'docker' group: 'sudo usermod -aG docker $USER && newgrp docker'
  Documentation: https://docs.docker.com/engine/install/linux-postinstall/

What can I do?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Tim
  • 1
  • 141
  • 372
  • 590
  • are you able to run `docker run hello-world` with out `sudo`? – Adiii Aug 22 '22 at 07:55
  • @Adiii no. I have to run docker commands with `sudo`. It may be because I started the daemon by `sudo dockerd &`. I couln't start the docker daemon without `sudo`, if I remember correctly. – Tim Aug 22 '22 at 08:09
  • and worth to consider `The problem was that I had to re-login after my user got the "docker" group. Everything works like a charm now!` – Adiii Aug 22 '22 at 08:14
  • Does [How to fix docker: Got permission denied issue](https://stackoverflow.com/questions/48957195/how-to-fix-docker-got-permission-denied-issue) answer your question? – David Maze Aug 22 '22 at 09:35
  • @ad why is it? It worked – Tim Aug 22 '22 at 19:10

1 Answers1

0

I tried running the same in a lot of ways.

curl -fsSL https://get.docker.com/rootless | sh
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-pluginmi

Nothing worked... But at last, running the below command worked...

docker context use default

This resolved my issue.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131