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

nvidia-docker2 support #781

Closed
niXta1 opened this issue Aug 3, 2019 · 11 comments
Closed

nvidia-docker2 support #781

niXta1 opened this issue Aug 3, 2019 · 11 comments

Comments

@niXta1
Copy link

niXta1 commented Aug 3, 2019

Is your feature request related to a problem? Please describe.
Passing through nvidia GPU to a container.

Describe the solution you'd like
Be able to use docker compose v2.3 or find a better way to get GPU to a container

Describe alternatives you've considered

  1. Override (needs to be using compose v2.3 i think?).
  2. Set the nvidia GPU to be used in all containers by modifying docker config.

This is on Ubuntu 18 with latest stabile docker.

@open-collective-bot
Copy link

Hey @niXta1 👋,

Thank you for opening an issue. We will get back to you as soon as we can. Also, check out our Open Collective and consider backing us.

https://opencollective.com/DockSTARTer

PS.: We offer priority support for all backers. Don't forget to add priority label when you start backing us 😄

@nemchik
Copy link
Member

nemchik commented Aug 3, 2019

If you're taking about Plex we've got documentation about adding the device to the container https://dockstarter.com/apps/plex/#hardware-transcoding that same method should at least be similar with other containers of you're not talking about Plex. Those other containers might also have their own documentation about how to get the device in. All that is just done via overrides.

That covers adding it to specific containers as needed, but not globally to all containers. I'm curious what your reasoning is for wanting it on ALL containers?

Also about the compose versions, what example do you have that if specific to version 2.x that does not work on 3.x?

@niXta1
Copy link
Author

niXta1 commented Aug 3, 2019

If you're taking about Plex we've got documentation about adding the device to the container https://dockstarter.com/apps/plex/#hardware-transcoding that same method should at least be similar with other containers of you're not talking about Plex. Those other containers might also have their own documentation about how to get the device in. All that is just done via overrides.

That covers adding it to specific containers as needed, but not globally to all containers. I'm curious what your reasoning is for wanting it on ALL containers?

Also about the compose versions, what example do you have that if specific to version 2.x that does not work on 3.x?

Yes, this is regarding Plex.

AFAIK nvidia GPU does not work with /dev/dri. It hasn't worked with any other docker setup, why would it work here?

AFAIK nvidia-docker2 'only' (I just read, don't shoot the messenger) works with v2.3 (https://github.com/NVIDIA/nvidia-docker/wiki#do-you-support-docker-compose).

If I can't use v2.3 with dockstarter, maybe it's possible to enable in the docker conf? It's just an idea.

Thanks for the quick reply!

@nemchik
Copy link
Member

nemchik commented Aug 3, 2019

https://github.com/NVIDIA/nvidia-docker/blob/master/README.md#quickstart according to their readme nvidia-docker2 is now deprecated. There should be an alternative way to achieve using their runtime, but I haven't dug that far into it.

@niXta1
Copy link
Author

niXta1 commented Aug 4, 2019

https://github.com/NVIDIA/nvidia-docker/blob/master/README.md#quickstart according to their readme nvidia-docker2 is now deprecated. There should be an alternative way to achieve using their runtime, but I haven't dug that far into it.

Sorry, my bad, it's not called docker-2 anymore.
There's not really a name for it (unless nvidia-docker?) as far as I can see, but what you need to install is 'nvidia-container-toolkit' to get it running. So let's call it nvidia-container-toolkit for now.

At the end it says:

Do you support Docker Compose?
Yes, use Compose format 2.3 and add runtime: nvidia to your GPU service. Docker Compose must be version 1.19.0 or higher. You can find an example here.

So, to get it working you need to:

  1. Install 'nvidia-container-toolkit' according to the instructions.
  2. use Compose format 2.3.
  3. add 'runtime: nvidia' in the compose file.

@nemchik
Copy link
Member

nemchik commented Aug 4, 2019

It looks like the new GPU support in docker 19.03 just needs to be added to compose for version 3.x. there's a few open issues on their GH you can follow.

docker/compose#6691
docker/compose#4657
docker/compose#6239

The first one is more promising and the last one seems less likely given the GPU support added to engine.

@niXta1
Copy link
Author

niXta1 commented Aug 4, 2019

It looks like the new GPU support in docker 19.03 just needs to be added to compose for version 3.x. there's a few open issues on their GH you can follow.

docker/compose#6691
docker/compose#4657
docker/compose#6239

The first one is more promising and the last one seems less likely given the GPU support added to engine.

As far as I can see, the newest of those is 3 months old with no reply and was closed... It doesn't look too promising?

@nemchik
Copy link
Member

nemchik commented Aug 4, 2019

I have tried in the past to allow the compose file version to be set by the user but have not been successful. I have some ideas about how I could do it, but this requires the compose templates we use to be made a little more version agnostic than they currently are. There's not a big demand for this at the moment, and some apps require features from newer compose versions (ex: labels introduced in compose file version 3.3). It makes more sense to request older apps to update than to restrict newer apps from functionality.

@daveb92
Copy link
Contributor

daveb92 commented Aug 20, 2019

I can confirm i have this working, override file for Plex is as below:

version: "3.4" # this must match the version in docker-compose.yml
services:
plex:
environment:
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=compute,video,utility

I set it up a while ago, but i do know that i had to change the docker to use the nvidia runtime as default in /etc/docker/daemon.json

{
"default-runtime": "nvidia",
"runtimes": {
"nvidia": {
"path": "nvidia-container-runtime",
"runtimeArgs": []
}
}
}

@niXta1
Copy link
Author

niXta1 commented Aug 21, 2019

I can confirm i have this working, override file for Plex is as below:

version: "3.4" # this must match the version in docker-compose.yml
services:
plex:
environment:

  • NVIDIA_VISIBLE_DEVICES=all
  • NVIDIA_DRIVER_CAPABILITIES=compute,video,utility

I set it up a while ago, but i do know that i had to change the docker to use the nvidia runtime as default in /etc/docker/daemon.json

{
"default-runtime": "nvidia",
"runtimes": {
"nvidia": {
"path": "nvidia-container-runtime",
"runtimeArgs": []
}
}
}

Sweet! Option nr. 2 it is!

@stale
Copy link

stale bot commented Oct 20, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 20, 2019
@stale stale bot closed this as completed Oct 27, 2019
@nemchik nemchik removed the wontfix label Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants