Connect to a Workspace
Connect to a Workspace
After a workspace is successfully created, the workspace is reachable via the ssh host WORKSPACE_NAME.devpod.
If you have selected an IDE to automatically open, DevPod will automatically try to open the IDE after a successful workspace creation or devpod up command.
You can change the default IDE to open globally via: devpod use ide vscode or devpod up my-workspace --ide vscode for an individual workspace.
VS Code Browser
DevPod is able to open VS Code in a browser in a workspace. It will use the open source project openvscode-server for installing a vscode server binary in the workspace and then tunnel a connection to that binary from the localhost. To open the workspace inside VS Code browser, you can run the following command:
devpod up my-workspace --ide openvscode
To select a different openvscode version, please run with:
devpod up my-workspace --ide openvscode --ide-option VERSION=v1.76.2
VS Code
Before connecting VS Code with DevPod, make sure you have installed the remote ssh extension and the code CLI. Then you can start the workspace directly in VS Code with:
devpod up my-workspace --ide vscode
If for whatever reason this does not work you can also use the regular SSH connection with WORKSPACE_NAME.devpod to connect VS Code with a workspace
JetBrains Suite (Goland, PyCharm, Intellij etc.)
Make sure you have JetBrains Gateway installed and a valid jetbrains subscription for your local IDE. The following JetBrains IDEs are supported:
- CLion (clion)
- Goland (goland)
- PyCharm (pycharm)
- Intellij (intellij)
- PhpStorm (phpstorm)
- WebStorm (webstorm)
- Rider (rider)
- RubyMine (rubymine)
Then start your workspace via:
devpod up my-workspace --ide goland
Which will install the goland server binary into the workspace and then open JetBrains Gateway to open this workspace.
After successful installation the Gateway SSH dialog will popup prefilled with the correct information, please click Check Connection and Continue, which will start your desired IDE inside the workspace.
To select a different IDE version, please run with:
devpod up my-workspace --ide goland --ide-option VERSION=2022.3.3
If for whatever reason this does not work you can also use the regular SSH connection with WORKSPACE_NAME.devpod to connect your JetBrains IDE with a workspace
SSH
Upon workspace creation, DevPod will automatically modify the ~/.ssh/config to include an entry for WORKSPACE_NAME.devpod, which allows you to use the following command to connect to your workspace:
ssh WORKSPACE_NAME.devpod
This also allows you to connect any IDE that supports remote development through SSH via the given host WORKSPACE_NAME.devpod.
DevPod CLI
If you don't have ssh installed or cannot connect through any other IDE, you can use the following DevPod command to access a workspace:
devpod ssh my-workspace
Optionally you can also define a command to run:
devpod ssh my-workspace --command "echo Hello World"
devpod ssh has more options for how the session runs:
# Start in another folder, or as another user
devpod ssh my-workspace --workdir /workspaces/my-workspace/api --user root
# Set variables in the container, or send ones from your computer
devpod ssh my-workspace --set-env MODE=debug --send-env HOME_REGION
# Don't forward your ssh-agent into the workspace
devpod ssh my-workspace --agent-forwarding=false
Forward ports
Reach a server that runs in the workspace on localhost of your computer, as long as the session is open. The
syntax is the one of ssh -L:
# http://localhost:8080 on your computer reaches port 3000 in the workspace
devpod ssh my-workspace -L 8080:localhost:3000
# Forward without a shell, and end when nothing has used the port for 10 minutes
devpod ssh my-workspace -L 8080:localhost:3000 --command "sleep infinity" --forward-ports-timeout 10m
To make a service on your computer reachable from the workspace, use -R in the same way:
devpod ssh my-workspace -R 5432:localhost:5432
With ssh, the same works through the workspace's host name:
ssh -L 8080:localhost:3000 my-workspace.devpod
Copy files
devpod cp copies files and directories to and from a workspace. A relative path in the workspace is relative to the
workspace folder:
devpod cp ./settings.json my-workspace:
devpod cp my-workspace:build .
The my-workspace.devpod host also works with any tool that uses ssh:
scp ./settings.json my-workspace.devpod:/workspaces/my-workspace/
rsync -av my-workspace.devpod:/workspaces/my-workspace/build/ ./build/
See Copy Files for where files land, which user they belong to, and what's kept.
IDE Commands
This section shows additional commands to configure DevPod's behavior when opening a workspace.
Configure IDE Options
You can specify certain options such as IDE version and download path if needed. You can list the available options for an IDE via:
devpod ide options openvscode
You will see available options and default values for them. To change an option, you can run:
devpod ide set-options openvscode -o VERSION=v1.76.2
Change Default IDE
To change the default IDE DevPod will use for connecting to a workspace, please run:
devpod ide use vscode
# Don't open an IDE after `devpod up`, unless one is given with --ide
devpod ide use none
List supported IDEs
You can list all DevPod supported IDEs via:
devpod ide list