VS Code Remote Tunneling Technical Setup Guide

This guide provides step-by-step instructions for setting up VS Code Remote Tunneling on PERIAN's Sky Platform using either GitHub or Microsoft authentication.

Prerequisites

Before you begin, ensure you have:

Available Images

We provide two pre-configured Docker images for VS Code Remote Tunneling on GitHub :

GitHub Authentication Image

FROM ubuntu:latest

ENV DEBIAN_FRONTEND=noninteractive

# Install dependencies and VS Code in a single layer to reduce image size
RUN apt-get update && apt-get install -y \
  curl \
  wget \
  git \
  gnupg \
  software-properties-common \
  apt-transport-https \
  && wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg \
  && install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg \
  && echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list \
  && apt-get update \
  && apt-get install -y code \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists/* packages.microsoft.gpg

RUN useradd -ms /bin/bash coder
USER coder
WORKDIR /home/coder

CMD ["code", "tunnel", "--accept-server-license-terms"]

Microsoft Authentication Image

FROM ubuntu:latest

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y \
  curl \
  wget \
  git \
  gnupg \
  software-properties-common \
  apt-transport-https \
  && wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg \
  && install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg \
  && echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list \
  && apt-get update \
  && apt-get install -y code \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists/* packages.microsoft.gpg

RUN useradd -ms /bin/bash coder
USER coder
WORKDIR /home/coder

ENV VSCODE_SERVER_DIR=/home/coder/.vscode-server
RUN mkdir -p ${VSCODE_SERVER_DIR}

ENTRYPOINT code tunnel user login --provider microsoft --accept-server-license-terms && code tunnel

Setup Instructions

1. Local Machine Setup

1. Install VS Code on your local machine

2. Install the Remote-Tunnels Extension

  • Open VS Code
  • Press Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (macOS)
  • Search for "Remote-Tunnels"
  • Click "Install"

2. Launch Remote Instance

Choose one of the following commands based on your preferred authentication method:
For GitHub Authentication:
# Example VM
perian job create \
  --image ghcr.io/perian-io/vscode-github-tunnel:latest \
  --accelerators 1 \
  --accelerator-type T4
For Microsoft Authentication:
# Example VM
perian job create \
  --image ghcr.io/perian-io/vscode-ms-tunnel:latest \
  --accelerators 1 \
  --accelerator-type T4

3. Authentication Process

GitHub Authentication:

  • Wait for the instance to start
  • Follow the GitHub device activation URL in the console output
  • Enter the provided code on GitHub
  • Wait for authentication to complete

4. Connecting from Local VS Code

  • Open VS Code on your local machine
  • Click the "Remote Explorer" icon in the sidebar (or press Ctrl+Shift+P and type "Remote-Tunnels: Connect to Tunnel")
  • Select your authenticated tunnel from the list
  • VS Code will connect to your remote instance

5. Managing Your Session

Starting Development:

  • Once connected, you can access all VS Code features as if running locally
  • The remote instance has full access to installed extensions and configurations
  • Use the integrated terminal for command-line operations
Ending Your Session:
# When finished, close the VM using:
perian job cancel --last

Troubleshooting

  • Connection Timeout
    • Check your internet connection
    • Verify the instance is still running using perian job list
    • Try restarting the tunnel service
  • Authentication Failures
    • Ensure your GitHub/Microsoft account has the correct permissions
    • Try logging out and back in
    • Check if you need to authorize the VS Code application in your account settings
  • Performance Issues
    • Consider adjusting the instance type using the --accelerator-type flag
    • Check network latency between your location and the instance
    • Verify you're not running resource-intensive processes in the background