Skip to content

Instantly share code, notes, and snippets.

@thehappycheese
Created September 26, 2025 15:09
Show Gist options
  • Select an option

  • Save thehappycheese/0328cc3629dbd90a471f194b70dcbfbc to your computer and use it in GitHub Desktop.

Select an option

Save thehappycheese/0328cc3629dbd90a471f194b70dcbfbc to your computer and use it in GitHub Desktop.
CUDA On Windows Docker
// place in ./.devcontainer folder
{
"name": "Python 3",
"dockerFile": "dockerfile",
"features": {
"ghcr.io/raucha/devcontainer-features/pytorch:1": {},// not sure if these are needed?
"ghcr.io/devcontainers/features/nvidia-cuda:2": {} // not sure if these are needed?
},
"runArgs": ["--gpus","all"], // apparently this is the magic that makes cuda work in docker desktop for windows
"postCreateCommand": "pip3 install --user -r requirements.txt",
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-toolsai.jupyter"
]
}
}
}
# place in ./.devcontainer folder
# This creates a 24GB container and takes ages to install; take a coffee breadk during build
FROM mcr.microsoft.com/devcontainers/python:1-3.12-bullseye
# Install CUDA toolkit (toolkit only, NOT drivers)
RUN apt-get update && apt-get install -y wget gnupg
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/cuda-keyring_1.0-1_all.deb
RUN dpkg -i cuda-keyring_1.0-1_all.deb
RUN apt-get update && apt-get install -y cuda-toolkit-12-4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment