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

Add note in README file #713

Closed
prankul88 opened this issue Jul 17, 2019 · 8 comments · Fixed by #714

Comments

@prankul88
Copy link

commented Jul 17, 2019

What would you like to be documented:
In README file under Installation and usage, there might be a need to add a note for the requirement of running docker as a non root user (running without sudo).
Good idea to add a link too.

Why is this needed:
As a new user when I was trying to run kind create cluster, I got an error "Error: could not list clusters: invalid output when listing nodes: WARNING: Error loading config file: /home/necuser/.docker/config.json: open /home/necuser/.docker/config.json: permission denied" and thus get a little confusing.

@tao12345666333

This comment has been minimized.

Copy link
Member

commented Jul 17, 2019

Thanks.

/assign

@BenTheElder

This comment has been minimized.

Copy link
Member

commented Jul 17, 2019

Technically kind needs to run as any user that has access to the docker socket, which may or may not be root depending on how you install docker. This is also true if using the docker CLI or other tools though.

@prankul88

This comment has been minimized.

Copy link
Author

commented Jul 17, 2019

@BenTheElder Thanks for replying. I am not well aware of how to run docker without binding to UNIX socket, but feel this might be the most common way of installation. So maybe this will be a nice addition in README file.
I saw your comment in the PR and thought maybe adding it here too will help.

@BenTheElder

This comment has been minimized.

Copy link
Member

commented Jul 17, 2019

I am not well aware of how to run Docker without binding to UNIX socket, but feel this might be the most common way of installation.

You definitely normally run it on a UNIX socket (can also be remote / TCP though), however a couple points / clarifications:

  • It's not about root / not-root users, it's about being a user with permission to the socket when executing kind or docker, which on Linux is typically the docker group, which very likely includes the root user, but technically depends on your specific installation of Docker.
  • On macOS / Windows this is a pretty much a non-issue, on Linux the upstream Docker installation docs document this:

https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-using-the-convenience-script

If you would like to use Docker as a non-root user, you should now consider adding your user to the “docker” group with something like:

  sudo usermod -aG docker your-user
  • kind has the same requirements to run as docker which I wouldn't expect to be surprising? If docker ps requires sudo docker ps to succeed on a system then kind requires sudo kind.

I don't feel the repo README is quite the correct place to bring this up, as we also don't get into docker installation details and I haven't seen any comparable docker tooling (including say, docker itself) discuss this there.

I do think this at least belongs in the known-issue guide however. 😅

@prankul88

This comment has been minimized.

Copy link
Author

commented Jul 18, 2019

@BenTheElder Great, I totally agree with you now. Thanks for sharing this informarion.
However I have a small doubt ,

If docker ps requires sudo docker ps to succeed on a system then kind requires sudo kind.

If I run command sudo kind it shows command not found. I am new to this and might be confusing myself a bit.

@BenTheElder

This comment has been minimized.

Copy link
Member

commented Jul 18, 2019

Ah, so if you installed kind with go or the make build it was likely installed to $HOME/go/bin/kind for that user, sudo will not inherent your environment variables, so there are a few options:

  • copy it to a system-wide PATH directory (eg possibly /usr/local/bin/kind)
  • use sudo env "PATH=$PATH" kind ... to preserve your PATH under sudo
  • install it again as root
  • use the full path to kind instead of just the command name
@tao12345666333

This comment has been minimized.

Copy link
Member

commented Jul 18, 2019

If I run command sudo kind it shows command not found. I am new to this and might be confusing myself a bit.

If you install kind via go get it will be install at $GOPATH/bin/kind and you should add your $GOPATH/bin to your $PATH so that you can using kind derectly.

If you using sudo kind, your current environment variables will not be maintained. xref https://superuser.com/questions/232231/how-do-i-make-sudo-preserve-my-environment-variables

@prankul88

This comment has been minimized.

Copy link
Author

commented Aug 13, 2019

Closing since a PR has been created fixing this issue.

@prankul88 prankul88 closed this Aug 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.