-
Notifications
You must be signed in to change notification settings - Fork 25
Debugging Remote Container
Remote Container Debugging allows you to use Visual Studio Code locally to debug code running in a container. No source code needs to be on your local machine since all execution happens on the remote instance.
Local Machine:
- Microsoft Visual Studio Code
- Visual Studio Code Splunk Extension
- Visual Studio Code Remote - Containers
Remote Container:
Remote access to a machine can be accomplished using a username and password or an SSH public/private key pair. Key-based authentication should improve security.
If you do not have an SSH key pair, open a bash shell or command line and run the following command to generate one:
ssh-keygen -t rsa -b 2048
You must add the SSH key to your remote SSH host. This process depends upon your SSH host and is not covered in this walkthrough.
The Remote SSH extension is installed by the Visual Studio Code Extension for Splunk. It adds an indicator to the bottom-left corner of the Status Bar in Visual Studio Code, indicating the context in which Visual Studio Code is running (local or remote). Click this indicator to bring up a list of Remote Extension commands.
Choose the Remote-SSH: Connect to Host command.
Specify the username@hostname
where username
is associated with the SSH key, and hostname
is the remote Splunk instance.
A new instance of Visual Studio Code will open, connected to the remote Splunk instance.
Choose Open folder...
Type in the path to your Splunk app location and click OK.
By default, the Python extension is not enabled for SSH. Click the Extensions button (1) in the Activity bar on the left, then click the Install in SSH button (2) for the Python extension.
You can now debug using the same techniques as if you were connected locally.
Ensure your SSH credentials have read permissions to necessary files.