Remote Development Using Digital Ocean: Remote SSH

A few years ago, I wrote an article about Using a DigitalOcean Droplet as a Development Environment, which focused on how to quickly create a droplet and connect using ssh, tmux & vim from my iPad Pro.

Let's update that for using devcontainers from a Macbook Pro and Visual Studio Code (vscode).


Following on from the example project from Devcontainers for Typescript

If you don't have a Digital Oceancommand-line account, start by creating one.

Remote SSH using VSCode

Then install the doctl command-line tool.

Upload your public ssh key. You'll need the key id for the next step.

doctl compute ssh-key list

Now, create a droplet. We'll create a 4 virtual CPUs with 16 GB of RAM, so we have the power to run a full development environment. If you need less, then use a smaller server. We'll use the docker image so that docker is set up and available for us.

doctl compute droplet create vscode-ssh-test --size s-4vcpu-16gb-amd --image docker-20-04 --region nyc1 --ssh-keys xxxxxxx

When this is done, you can list them.

doctl compute droplet list

Connect to it using the IP address and root.

ssh root@xxx.xxx.xxx.xxx

Best to set up an alias in your ~/.ssh/config

Host digitalocean-example
  Hostname xxx.xxx.xxx.xxx
  User root
  ForwardAgent yes

Now you can ssh in by name

ssh digitalocean-example

Clone your git repo, here I'll use https://github.com/markcallen/devcontainer-typescript-example

mkdir src
cd src
git clone https://github.com/markcallen/devcontainer-typescript-example

Now, make sure you have the Remote SSH extension installed in your vscode. For more details, see: Remote Development using SSH

From VSCode, open Remote SSH: Connect to Host and enter the name of the connection. For this example, I've used digitalocean-example

This will open up a new VSCode window. Open, File: Open Folder and enter /root/src/devcontainer-typescript-example When prompted, Reopen in Container.

Now you are running in a devcontainer on a DigitalOcean droplet.

VSCode: devcontainer running on a droplet

Don't forget to power-off the droplet when you're done.

doctl compute droplet list

doctl compute droplet-action power-off <droplet id>

Now you've set up a remote development environment using Visual Studio Code and devcontainers on a DigitalOcean droplet. Designed for developers working from a MacBook Pro, it covers how to spin up a DigitalOcean server, configure a development container, and connect VSCode remotely. The setup enables consistent, containerized dev environments accessible from anywhere, ideal for cloud-native workflows and team collaboration.