I need to run a Python script within an NVIDA GPU Cloud (NGC) container on Docker in Ubuntu and I want to use Visual Studio Code to edit, run and debug it. I have installed the VS Code Docker Extension and read the documentation but none of it seems to fit my purpose.
I have followed the NGC docs, installed the NVIDIA Container Runtime for Docker (nvidia-docker2) and am now at the point where on the command line I would launch an NGC container tarball
docker load -i foo.tar
sudo docker run {...}
How do I configure VS Code so that I can run and debug Python scripts within this container?
Download the NVIDA GPU Cloud (NGC) container.
Create /home/bob/foobar.py in Visual Studio Code with the VS Code Docker Extension
Set a breakpoint on the last line.
Debug|Add Configuration
Docker: Attach to Node
In launch.json add to "configurations"
Open a Terminal window:
Start the debugger with configuration "Python Attach (Remote Debug ptsvd default)". It stops at the breakpoint.