Docker Desktop (Windows host) with GPU(s) enabled

This post has two parts: 1) my success so far with the Fast.ai docker image (with the Dockerfile I wrote), and 2) questions for developers for usage with Jupyter on Windows.

Part 1

HW Specs:
AMD Ryzen 9 5950X, RTX 3070 8GB VRAM, Samsung NVMe (system drive), 64GB DDR4 RAM.
SW Environment:
Windows 11, WSL2 with Ubuntu 20.04, Docker Desktop v20.10.13

Base Docker images used:

consol/centos-xfce-vnc:1.1.0
nvidia/cuda:11.6.0-base-ubuntu20.04
fastdotai/fastai-course:latest

Dockerfile

FROM consol/centos-xfce-vnc:1.1.0
LABEL Tobias Schneck "tobias.schneck@consol.de"
ENV REFRESHED_AT 2017-04-10

USER 0
FROM nvidia/cuda:11.6.0-base-ubuntu20.04
CMD nvidia-smi

FROM fastdotai/fastai-course:latest
USER 1984

To build image, create/run container, and launch Jupyter Notebook, type the following commands in a Windows PowerShell session (make sure to replace the fields denoted by “{}”):

cd {./path/to/Dockerfile}
docker build . -t {image-name}
docker run -it --name {container-name} --user 0 --gpus all -p 5901:5901 -p 6901:6901 -p 8888:8888 {image-name} ./run_jupyter.sh

Ctrl+LMB on the last displayed link (you might need to wait a couple minutes before your browser will connect properly)

Part 2

So I was able to get everything to work up to the last step above. What tripped me up, is when I tried to run one of the Fast-ai notebooks and got that multiprocessing error which happens while using Jupyter on Windows. It appears that the “Worker Count” was not automatically set to “0” as expected. Is there a way to manually do this so I can still run the course notebooks? Thanks!

Update on March 17, 2022

Problem solved! All I had to do is set the keyword argument “num_workers” to “0” as part of the data loaders setup.

Just in case anyone is interested, with 2 small changes to the dockerfile you can run the latest version of fast.ai and run it using an RTX 3090

FROM consol/centos-xfce-vnc:1.1.0
LABEL Tobias Schneck “tobias.schneck@consol.de
ENV REFRESHED_AT 2017-04-10

USER 0
FROM nvidia/cuda:11.0.3-base-ubuntu20.04
CMD nvidia-smi

FROM fastdotai/fastai-course:latest
RUN pip install torch==1.10.1+cu111 torchvision==0.11.2+cu111 torchaudio==0.10.1 -f https://download.pytorch.org/whl/cu111/torch_stable.html
RUN pip install fastbook==0.0.29
USER 1984