This is something I've spent a lot of time implementing, at this time (nomad 0.7.0 though running 5.6 myself) there is no 'nomadic' way to implement a nvidia-docker job without using raw fork/exec which doesn't provide container orchestration, service discovery, log shipping, resource management (i.e. bin packing).
I was surprised that the nvidia-docker command doesn't actually act on behalf of docker, alternatively it forwards commands to docker. The only time it is really ever useful is when calling the run/exec commands (ie nvidia-docker run --yar blar
) as it calls a helper program that returns a json response with the appropriate device and volume mounts in json format. When the container data is sent to the actual docker socket it includes the correct device and volume for the version of cuda that is installed on the host (inspect your container ).
The other part of implementing this solution using an exec driver is to create a task that acts on behalf of the deployment if you wish to have rolling deploys. I am using a simple script to orchestrate a rolling deploy inside the same task group as the nvidia-docker task. So long as you are using stagger, max parallel (set to 1) in your task group and ensuring you have a dynamic argument like random or date in the orchestration task (nomad will not update the task if there are 0 differences) you should be set.
Once nomad has the ability to compute gpu (need custom fingerprint here: https://github.com/hashicorp/nomad/tree/master/client/fingerprint ) resource type and has the ability to mount non block type devices (ie something not a disk) it should be possible to circumvent using nvidia-docker. I hope this helps, be sure to bump the feature request here:
https://github.com/hashicorp/nomad/issues/2938
To also expand on running this operation using conventional docker, you must also mount the volume created by nvidia-docker. docker volume ls
will show named volumes, you must mount the cuda volume for your container to have access to the drivers (unless you are already stuffing into your container, not recommended).