Skip to content

For those times when nvidia-docker is not possible (like AWS ECS)

License

Notifications You must be signed in to change notification settings

bfolkens/nvidia-docker-bootstrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

nvidia-docker-bootstrap

Provides a solution for the times when nvidia-docker isn't something that is available for use. A good example of this is in AWS's ECS environment, where the docker containers are created without invoking the command line client.

Background

This script was made as a result of the comments and revisions from the article Deep Learning Image Recognition Using GPUs in Amazon ECS Docker Containers, and after several months of using these tweaks in production environments at CloudSight.

Instructions

Install the NVIDIA drivers into your docker host machine. This might look a bit different depending on your distro, but in general will look something like this:

sudo yum groupinstall -y "Development Tools"
version=364.19
arch=`uname -m`
wget http://us.download.nvidia.com/XFree86/Linux-${arch}/${version}/NVIDIA-Linux-${arch}-${version}.run
sudo bash ./NVIDIA-Linux-${arch}-${version}.run -silent

When you run your container, make sure to enable the --privileged mode. The bootstrap script below will copy the drivers from the host into the running container, so you'll need to attach a volume for /usr as /hostusr. The command to do this in docker looks something like:

docker run --rm -it --privileged -v /usr:/hostusr [your-image]

Next, run the bootstrap.sh file in a running container to copy the driver files from the host container.

wget -O- https://git.io/vHckS | bash

A typical setup would have the bootstrap script downloaded to the image, then execute after the container is running. A great place to put this is in an entrypoint script that is run from CMD.

About

For those times when nvidia-docker is not possible (like AWS ECS)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages