← All articles
Tools1 min read

Remote Development in VS Code

Edit code that lives on a server, in a container, or in WSL as if it were local. VS Code's remote extensions make the environment gap disappear.

S

Swapnika Voora

Author

Your laptop and your production-like environment rarely match. VS Code's remote development lets the editor UI run locally while the language servers, terminal, and extensions execute where the code actually lives.

Three flavors of remote

All three share the same model: a lightweight server runs on the remote side and your local VS Code connects to it.

remote targets
Remote - SSH          Work on any machine you can SSH into
Dev Containers        Work inside a Docker container
WSL                   Work inside a Linux distro on Windows

Reproducible dev containers

A devcontainer.json describes a complete, disposable development environment. Anyone who opens the repo gets the exact same toolchain.

.devcontainer/devcontainer.json
{
  "name": "spring-service",
  "image": "mcr.microsoft.com/devcontainers/java:21",
  "features": {
    "ghcr.io/devcontainers/features/docker-in-docker:2": {}
  },
  "forwardPorts": [8080],
  "postCreateCommand": "./mvnw dependency:go-offline"
}

Ports just work

forwardPorts tunnels a remote port to localhost, so a service running in the container is reachable at http://localhost:8080 on your machine.

Takeaways

  • The editor stays local while execution happens on the remote target.
  • Dev containers make the whole toolchain reproducible and disposable.
  • forwardPorts bridges remote services to your local browser seamlessly.

Dev containers pair especially well with CI — the same image can build your code locally and on the pipeline, eliminating "works on my machine."

#vs-code#remote#containers

More in Tools