Tensorflow GPU with Docker Dev Environments in WSL
- Windows 11
- Windows Subsystem for Linux (WSL 2)
- Git on WSL (optional)
- Docker Desktop WSL 2
- Latest NVIDIA Windows GPU Driver
- Visual Studio Code with Dev Container extension
- Create a new repository from the template or clone the code
- In
Dockerfile
:- Update
USERNAME
ARG to create a non-root user - Update
USER_UID
andUSER_GID
ARGs (useid
command in your Terminal to get them) - Update tensorflow image version (optional)
- Update required packages (optional)
- Update
- Update pip packages in
requirements.txt
(optional) - Docker Desktop > Dev Environments > Create (from a Git repo or a Local directory)
After the Dev Environment has been created:
- Docker Desktop > Dev Environments > OPEN IN VSCODE
- VSCODE > Terminal > New Terminal
python main.py
Note. If you update the configuration files after the Dev Environment has been created, you must delete and recreate it