Skip to content
 
 

Repository files navigation

Open Remote - Devcontainer

Pre-0.5.0, the extension relied on an SSH server inside the container via open-remote-ssh by @jeanp413.

From 0.5.0 onwards, the VS Code proposed resolver API is used and must be enabled in argv.json.

How it works

  1. Reads .devcontainer/devcontainer.json from your workspace
  2. Builds a container image from the specified image or dockerFile
  3. Starts the container with your workspace bind-mounted
  4. Installs the VSCodium Remote Extension Host (vscodium-reh) inside the container
  5. Connects via a direct TCP tunnel (no SSH)

Getting started

  1. Install the extension
  2. Enable the proposed resolver API
  3. Create .devcontainer/devcontainer.json in your project (or use Devcontainer: Add Dockerfile Template)
  4. Run Devcontainer: Open Folder in container from the command palette
{
    ...
    "enable-proposed-api": [
        ...,
        "mythreyak.open-remote-devcontainer",
    ]
    ...
}

You can configure this by running the Preferences: Configure Runtime Arguments command. The file is located in ~/.vscode-oss/argv.json.

Supported devcontainer.json fields

Field Status
image Supported
dockerFile Supported
remoteUser Supported
postCreateCommand Supported (runs as RUN during image build)
postStartCommand Supported (runs in terminal after connect)
mounts Supported (string and object format, with custom options for SELinux :z/:Z)
runArgs Supported (passed through to docker run)
${localEnv:VAR} Supported in mounts, runArgs, and lifecycle commands
features Not yet
forwardPorts Not yet

Commands

  • Devcontainer: Open Folder in container — build (if needed) and connect
  • Devcontainer: Rebuild & reopen in container — force rebuild and reconnect
  • Devcontainer: Open Devcontainer Configuration — open devcontainer.json
  • Devcontainer: Add Dockerfile Template — scaffold .devcontainer/Dockerfile
  • Devcontainer: Rebuild without cache & reopen in container — rebuild image from scratch and reconnect
  • Devcontainer: Show Log — open build/connection logs (WIP)
  • Devcontainer: Reopen Folder Locally — disconnect and reopen on host
  • Devcontainer: Show Actions — quick pick menu for all commands

Settings

Setting Default Description
remote.devcontainer.containerBinary docker Container CLI (docker or podman)
remote.devcontainer.containerExtraArgs [] Extra args passed before the subcommand (e.g. ["--root", "/custom/storage"])

Development

npm install
npm run dts          # generate vscode type definitions
npm run compile      # type check + build
npm test             # run unit tests
npm run format       # auto-format with biome
npm run lint         # lint check

Reproducible builds

To validate a release, use node:22.22.3-bookworm-slim and run build.py in the container. It runs git checkout, runs the build, and dumps the hash.

$ podman run --rm -it   \
    --entrypoint bash   \
    -v $PWD:/workdir:z --workdir /workdir \
    node:22.22.3-bookworm-slim
# apt update -y && apt install -y git python3
# ./build.py --release <tag>
# ./build.py --pre-release <tag>
# ./build.py --nightly [commit]

and compare the output against the SHA on the releases page. This is experimental.

Acknowledgements

This project would not have been possible without the work of:

Disclaimer

Claude and Opencode were used for the initial prototyping using the above implementations as references. A rewrite will (probably) come soon.

About

VSCodium Extension for duilding and running a devcontainer using a Docker image, then open your workspace over SSH in the container

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages