You must edit /etc/docker/daemon.json by adding the first level key "default-runtime": "nvidia" , restart the docker daemon (for example, "sudo service docker restart" ), and then all containers on this host will run with nvidia runtime.
More information about daemon.json here
source share