0

What is the best way to launch nvidia-docker containers using Marathon? I know Marathon has two ways to launch containers which is basically either providing a shell cmd as an argument in the JSON or by specifying the parameters using the container field. However I haven't found a way to specify launching containers with nvidia-docker versus regular docker other than the "cmd" field in the JSON.

Also what are the downsides to launching using the cmd as in argument so something like this:

{
"id": "myimage",
"cmd": "nvidia-docker run -it myimage bash",
"cpus": 1,
"mem": 512.0,
"instances": 3,
}

Versus using the "container" field:

{
"id": "myimage",
"cpus": 1,
"mem": 512.0,
"instances": 3,
"container": {
    "type": "DOCKER",
    "docker": {
        "image": "myimage",
        "network": "HOST"
    }
}
}
EMChamp
  • 449
  • 1
  • 7
  • 13

1 Answers1

2

Assuming you're using nvidia-docker to leverage GPU resources, you don't need to use nvidia-docker at all, because the GPU support in Mesos already provides everything needed to do that using the Mesos containerizer. You will need a recent version of Mesos (>=1.0) and Marathon (>=1.3 started with --enable_features gpu_resources).

If for some reason this doesn't apply to your case, you could directly call nvidia-docker by setting the cmd field, as you did in your first example. Though this may have some caveats, as it will talk directly communicate with the docker daemon, probably bypassing Mesos isolators.

nfnt
  • 66
  • 2
  • The sentence "Assuming you're using nvidia-docker to leverage GPU resources, you don't need to use nvidia-docker at all" is a bit confusing. I managed to get gpu support working with the mesos containerizer and with the gpu_resources flag enabled. I do have the nvidia-docker package installed, but am not setting any of the docker flags or calling nvidia-docker explicitly. Do I even need to have this package installed? Thanks. – MarkNS Dec 02 '16 at 10:33
  • No, you don't need this package installed, the only dependency is [a Nvidia kernel driver](http://mesos.apache.org/documentation/latest/gpu-support/#external-dependencies), though it also makes sense to install the CUDA toolkit. – nfnt Dec 06 '16 at 15:44