#Preparation Install nvidia driver and cuda on your host. (it can be a little tricky so i will suggest you follow this guide http://askubuntu.com/questions/451672/installing-and-testing-cuda-in-ubuntu-14-04https://askubuntu.com/questions/451672/installing-and-testing-cuda-in-ubuntu-14-04)
#Preparation Install nvidia driver and cuda on your host. (it can be a little tricky so i will suggest you follow this guide http://askubuntu.com/questions/451672/installing-and-testing-cuda-in-ubuntu-14-04)
#Preparation Install nvidia driver and cuda on your host. (it can be a little tricky so i will suggest you follow this guide https://askubuntu.com/questions/451672/installing-and-testing-cuda-in-ubuntu-14-04)
If the result is blank, use launching one of the samples on the host should do the trick. The result should look like that ![enter image description here][1] [1]: https://i.sstatic.net/j8Jr3.png As you can see there is a set of 2 numbers between the group and the date. These 2 numbers are called major and minor numbers (writedwrote in that order) and design a device. We will just use the major numbers for convenience.
If the result is blank, use launching one of the samples on the host should do the trick. The result should look like that ![enter image description here][1] [1]: https://i.sstatic.net/j8Jr3.png As you can see there is a set of 2 numbers between the group and the date. These 2 numbers are called major and minor numbers (writed in that order) and design a device. We will just use the major numbers for convenience.
If the result is blank, use launching one of the samples on the host should do the trick. The result should look like that ![enter image description here][1] [1]: https://i.sstatic.net/j8Jr3.png As you can see there is a set of 2 numbers between the group and the date. These 2 numbers are called major and minor numbers (wrote in that order) and design a device. We will just use the major numbers for convenience.
FROM ubuntu:14.04 MAINTAINER Regan <http://stackoverflow.com/questions/25185405/using-gpu-from-a-docker-container> RUN apt-get update RUN && apt-get install -y build-essential RUN apt-get --purge remove -y nvidia* ADD ./Downloads/nvidia_installers /tmp/nvidia > Get the install files you used to install CUDA and the NVIDIA drivers on your host RUN /tmp/nvidia/NVIDIA-Linux-x86_64-331.62.run -s -N --no-kernel-module > Install the driver. RUN rm -rf /tmp/selfgz7 > For some reason the driver installer left temp files when used during a docker build (i don't have any explanation why) and the CUDA installer will fail if there still there so we delete them. RUN /tmp/nvidia/cuda-linux64-rel-6.0.37-18176142.run -noprompt > CUDA driver installer. RUN /tmp/nvidia/cuda-samples-linux-6.0.37-18176142.run -noprompt -cudaprefix=/usr/local/cuda-6.0 > CUDA samples comment if you don't want them. RUN export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64 > Add CUDA library into your PATH RUN touch /etc/ld.so.conf.d/cuda.conf > Update the ld.so.conf.d directory RUN rm -rf /temp/* > Delete installer files. FROM ubuntu:14.04 MAINTAINER Regan <http://stackoverflow.com/questions/25185405/using-gpu-from-a-docker-container> RUN apt-get update RUN apt-get install -y build-essential RUN apt-get --purge remove -y nvidia* ADD ./Downloads/nvidia_installers /tmp/nvidia > Get the install files you used to install CUDA and the NVIDIA drivers on your host RUN /tmp/nvidia/NVIDIA-Linux-x86_64-331.62.run -s -N --no-kernel-module > Install the driver. RUN rm -rf /tmp/selfgz7 > For some reason the driver installer left temp files when used during a docker build (i don't have any explanation why) and the CUDA installer will fail if there still there so we delete them. RUN /tmp/nvidia/cuda-linux64-rel-6.0.37-18176142.run -noprompt > CUDA driver installer. RUN /tmp/nvidia/cuda-samples-linux-6.0.37-18176142.run -noprompt -cudaprefix=/usr/local/cuda-6.0 > CUDA samples comment if you don't want them. RUN export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64 > Add CUDA library into your PATH RUN touch /etc/ld.so.conf.d/cuda.conf > Update the ld.so.conf.d directory RUN rm -rf /temp/* > Delete installer files. FROM ubuntu:14.04 MAINTAINER Regan <http://stackoverflow.com/questions/25185405/using-gpu-from-a-docker-container> RUN apt-get update && apt-get install -y build-essential RUN apt-get --purge remove -y nvidia* ADD ./Downloads/nvidia_installers /tmp/nvidia > Get the install files you used to install CUDA and the NVIDIA drivers on your host RUN /tmp/nvidia/NVIDIA-Linux-x86_64-331.62.run -s -N --no-kernel-module > Install the driver. RUN rm -rf /tmp/selfgz7 > For some reason the driver installer left temp files when used during a docker build (i don't have any explanation why) and the CUDA installer will fail if there still there so we delete them. RUN /tmp/nvidia/cuda-linux64-rel-6.0.37-18176142.run -noprompt > CUDA driver installer. RUN /tmp/nvidia/cuda-samples-linux-6.0.37-18176142.run -noprompt -cudaprefix=/usr/local/cuda-6.0 > CUDA samples comment if you don't want them. RUN export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64 > Add CUDA library into your PATH RUN touch /etc/ld.so.conf.d/cuda.conf > Update the ld.so.conf.d directory RUN rm -rf /temp/* > Delete installer files.