use nvidia-docker from docker-compose

UPDATE : please check nvidia-docker 2 and its support of docker-compose first https://github.com/NVIDIA/nvidia-docker/wiki/Frequently-Asked-Questions#do-you-support-docker-compose

(I'd first suggest adding the nvidia-docker tag).

If you look at the nvidia-docker-compose code here it only generates a specific docker-file for docker-compose after a query of the nvidia configuration on localhost:3476.

You can also make by hand this docker-compose file as they turn out to be quite simple, follow this example, replace 375.66 with your nvidia driver version and put as many /dev/nvidia[n] lines as you have graphic cards (did not try to put services on separate GPUs but go for it !):

services:
  exampleservice0:
    devices:
    - /dev/nvidia0
    - /dev/nvidia1
    - /dev/nvidiactl
    - /dev/nvidia-uvm
    - /dev/nvidia-uvm-tools
    environment:
    - EXAMPLE_ENV_VARIABLE=example
    image: company/image
    volumes:
    - ./disk:/disk
    - nvidia_driver_375.66:/usr/local/nvidia:ro
version: '2'
volumes:
  media: null
  nvidia_driver_375.66:
    external: true

Then just run this hand-made docker-compose file with a classic docker-compose command.

Maybe you can then compose with non nvidia dockers by skipping the nvidia specific stuff in the other services.