Skip to content

Conversation

@jmcphers
Copy link
Collaborator

@jmcphers jmcphers commented Dec 2, 2025

This change adds early, experimental support for Dev Containers to Positron.

image

Because the feature is experimental, it is currently behind a feature flag:

image

The goal of this change is to enable the most common dev container workflows that center around building (or rebuilding) a container and opening the workspace inside the container. However, note that in this early version, many features are not implemented or are incomplete. Specifically:

  • musl-based Linux distributions (such as Alpine) are not supported (Support for Alpine Linux / musl (non-glibc) remote hosts & backends #10468); the container must be running a version of Linux already supported by Positron
  • Only single-container configurations are supported (no docker compose)
  • No tools or templates are supplied for creating or authoring devcontainer.json files
  • Only one container is supported per project
  • Docker volumes are not supported, just regular mounts
  • In the MRU, dev containers show up with the remote rather than local path (e.g. /workspaces/foo)
  • Container management features (see/attach to running containers) are not available when inside a container

For compatibility, the new extension uses largely the same command names and settings as the official VS Code Dev Containers extension.

It also includes a lightly modified version of the Dev Containers CLI reference implementation. The implementation is used to derive the correct container management commands, which are (generally) executed in Positron terminals for visibility.

Addresses #4691.

Release Notes

New Features

Bug Fixes

  • N/A

QA Notes

Like Remote SSH, this feature is difficult to test outside release builds since it needs to download a matching server component into the container. And -- also like remote SSH -- there's a setting to change the download URL. If you need to test a build that doesn't have a released Positron version to download, you can change this setting to the URL of the closest matching build.

This feature should be tested across all three operating systems since the Docker integration is somewhat OS-specific.

@github-actions
Copy link

github-actions bot commented Dec 2, 2025

E2E Tests 🚀
This PR will run tests tagged with: @:critical

readme  valid tags

@jmcphers jmcphers requested a review from Copilot December 2, 2025 19:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds experimental Dev Container support to Positron, implementing a subset of the VS Code Dev Containers functionality. The implementation uses a lightly modified version of the MIT-licensed Dev Containers CLI reference implementation to derive container management commands that are executed in Positron terminals for visibility. The feature is behind an experimental flag and focuses on the most common workflows: building/rebuilding containers and opening workspaces inside containers. Several advanced features are not yet implemented, including musl-based Linux support, docker compose, container management features, and volume support.

Reviewed changes

Copilot reviewed 69 out of 113 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
extensions/positron-dev-containers/src/spec/spec-node/devContainers.ts Core provisioning logic for dev containers including Docker parameter creation and logging setup
extensions/positron-dev-containers/src/spec/spec-node/containerFeatures.ts Implementation for extending container images with dev container features, including BuildKit support and feature layer generation
extensions/positron-dev-containers/src/spec/spec-node/configContainer.ts Configuration resolution logic for dev containers, handling different config types (image, dockerfile, compose)
extensions/positron-dev-containers/src/spec/spec-node/commandGeneration.ts Command generation utilities for creating docker commands without executing them
extensions/positron-dev-containers/src/spec/spec-node/collectionCommonUtils/*.ts Package, publish, and docs generation utilities for dev container features and templates
extensions/positron-dev-containers/src/spec/spec-configuration/*.ts Configuration parsing, OCI registry handling, and feature/template management
extensions/positron-dev-containers/src/spec/spec-common/*.ts Common utilities including variable substitution, shell server, git operations, and process management
extensions/positron-dev-containers/extension.webpack.config.js Webpack configuration for the extension
build/npm/dirs.js Added extension directory to npm build configuration
Files not reviewed (1)
  • extensions/positron-dev-containers/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

extensions/positron-dev-containers/src/spec/spec-common/commonUtils.ts:1

  • Missing indentation on line 1123. The await statement should be indented to align with the content of the if block.
/*---------------------------------------------------------------------------------------------

Copy link
Contributor

@austin3dickey austin3dickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some really early comments - I haven't looked at the code yet, or even got it to work all the way, since I need to set up the "get a dev build into the container" thing still. But WIP!


## Requirements

- Docker or Podman installed and running
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm gonna use OrbStack, wish me luck

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it worked! (it's basically the same as docker haha)

"command": "remote-containers.settings",
"title": "%command.settings%",
"category": "%command.category%"
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'm seeing some of these commands when the feature flag is off, and they don't work. (Not a big deal)

Image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, we should just hide these. Done in cb2ae26

const mounts: string[] = [];
if (devContainerConfig.mounts) {
for (const mount of devContainerConfig.mounts) {
mounts.push(mount);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to build the Positron devcontainer and it didn't work because the docker create command had --mount [object Object]. If we don't want to support these complex mounts right now can we throw a more informative error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh we can do that! Done in f96f676

const generateShellScript = () => {
let script = '#!/bin/sh\nset -e\n\n';
script += '# Trap errors to keep terminal open so user can see what failed\n';
script += 'trap \'echo ""; echo "==> ERROR: Build failed! Press Enter to close this terminal..."; read dummy\' ERR\n\n';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I press enter to close the terminal, it pops up a toast. Can we suppress this?

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants