Skip to content

Instantly share code, notes, and snippets.

@j3rmp4d93
Last active June 9, 2025 05:33
Show Gist options
  • Save j3rmp4d93/30eb8b9e8ad2e453a253bd10a1c8cf22 to your computer and use it in GitHub Desktop.
Save j3rmp4d93/30eb8b9e8ad2e453a253bd10a1c8cf22 to your computer and use it in GitHub Desktop.
Connecting to a Singularity container with VS Code
Follow url below to setup VS Remote-SSH to Singularity container
https://docs.icer.msu.edu/2023-11-03_LabNotebook_VSCode_Singularity/
Kill VS Code Servers:
Originally, you have to do "Remote-SSH: Kill VS Code Server on Host ..." and "Remote-SSH: Kill Local Connection Server For Host..." each time before you connect to the container.
Instead, we can modify RemoteCommand as: systemctl --user stop singularity.scope ; sleep 2 ;systemd-run --user --scope --unit=singularity.scope bash -c "singularity shell /mnt/home/grosscra/tensorflow_latest-gpu-jupyter.sif"
So each time we connect to the container, the previous VS Code server instance associated with the singularity.scope will be stopped, and a new VS Code server will be launched automatically inside the tensorflow_latest-gpu-jupyter.sif singularity container.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment