Skip to content

Instantly share code, notes, and snippets.

@aspotton
Created January 5, 2019 20:35
Show Gist options
  • Save aspotton/1c93e871a103a8a8ae3a8440abd4b46b to your computer and use it in GitHub Desktop.
Save aspotton/1c93e871a103a8a8ae3a8440abd4b46b to your computer and use it in GitHub Desktop.
Use Nvidia GPU inside of an unprivileged container without nvidia-docker
# Assumes that these are installed on the host system:
# * nvidia binary drivers
# * CUDA
# * cuDNN
docker run -it --rm $(ls /dev/nvidia* | xargs -I{} echo '--device={}') $(ls /usr/lib/*-linux-gnu/{libcuda,libnvidia}* | xargs -I{} echo '-v {}:{}:ro') -v $(pwd):/code test:test /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment