Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

nvidia-docker not working correctly on machines where sudo is required to run docker #9

Closed
elezar opened this issue Nov 17, 2015 · 3 comments

Comments

@elezar
Copy link
Member

elezar commented Nov 17, 2015

On machines where sudo permissions are required for docker (see for exampel the discussion on/etc/sudoers from http://www.projectatomic.io/blog/2015/08/why-we-dont-let-non-root-users-run-docker-in-centos-fedora-or-rhel/), the nvidia-docker script does not seem to work as expected.

I have tried the following:

  1. Added alias docker='sudo /usr/bin/docker' to ~/.bashrc
  2. Added alias docker='sudo /usr/bin/docker' to ~/.profile

But the alias not correctly propagated to nvidia-docker.

Adding alias docker='sudo /usr/bin/docker' to the top of the nvidia-docker script directly allows for the script to work correctly in this setting.

Any pointers on how this could be addressed locally?

@3XX0
Copy link
Member

3XX0 commented Nov 17, 2015

Aliases are not propagated through non-interactive shells hence your error.
What you can do instead is using sudo on the nvidia-docker script: alias docker='sudo nvidia-docker'

@elezar
Copy link
Member Author

elezar commented Nov 17, 2015

The problem is that I have only been given sudo access (without password)
for running "/usr/bin/docker" on this particular machine. This means that I
cannot use an alias for nvidia-docker directly.

On Tue, Nov 17, 2015 at 10:26 PM Jonathan Calmels notifications@github.com
wrote:

Aliases are not propagated through non-interactive shells hence your error.
What you can do instead is using sudo on the nvidia-docker script:
alias docker='sudo nvidia-docker'


Reply to this email directly or view it on GitHub
#9 (comment).

@3XX0 3XX0 closed this as completed in 0c18d73 Nov 17, 2015
@3XX0
Copy link
Member

3XX0 commented Nov 17, 2015

You should now be able to do: DOCKER='sudo docker' ./nvidia-docker ...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants