I am trying to run an application inside a docker container in Windows 10.
But I am not able to get the GPU working inside docker.
I read that it needs "GPU Pass-through."
How should I get around this?
Update (December 2020) You can now do GPU pass-through on Windows, if you use WSL 2 as the backend for Docker: WSL 2 GPU Support is Here - that is a slightly neater method than running Docker inside WSL.
Original answer:
GPU access from within a Docker container currently isn't supported on Windows.
You need nvidia-docker
, but that is currently only supported on Linux platforms. GPU passthrough with Hyper-v would require Discrete Device Assignment (DDA), which is currently only in Windows Server, and (at least in 2015) there was no plan to change that state of affairs. Hence, NVIDIA are not porting nvidia-docker
to Windows at the moment.
A bit more info here: https://devblogs.nvidia.com/nvidia-docker-gpu-server-application-deployment-made-easy/
Update (October 2019): nvidia-docker
is deprecated, as Docker 19.03 has native support for NVIDIA GPUs. Instead install nvidia-container-runtime
, and use the docker run --gpus all
flag. You can also run Windows Containers with GPU acceleration on a Windows host, using Docker 19.03, but not a Linux container.
Update (August 2020): It looks like you can now do GPU pass-through when running Docker inside the Windows Subsystem for Linux (WSL 2).
This link goes through installation, setup and running a TensorFlow Jupyter notebook inside Docker in Ubuntu in WSL 2, with GPU support: https://ubuntu.com/blog/getting-started-with-cuda-on-ubuntu-on-wsl-2
Note - I haven't done this myself yet.