microsoft / microsoft/vscode-remote-release

devcontainer.json: add support for multi-platform "localEnv" in "mounts"

Open
#10,945 15 comments 14 reactions 1 assignee View on GitHub

@chrmarti is already working on this.

Since May 11, 2025.

containers feature-request
Dominant language
Dockerfile
Stars
4.2k
Forks
469
Avg merge
1d 1h
Merged PRs (30d)
1

Description

First and foremost: thank you guys for your amazing work with VSCode!

Use Case

I have a devcontainer.json that on Windows mounts "/home/nwtimetracking/" to "C:\Users\Desktop<my_username>\nwtimetracking".

The problem arises when I load the project on Linux, where I do get a "A mount config is invalid" error message and I can't proceed until I manually switch USERPROFILE with HOME.

devcontainer.json
https://github.com/numbworks/nwtimetracking/blob/master/.devcontainer/devcontainer.json

{
	"build": { 
		"dockerfile": "Dockerfile" 
	},
	"customizations": {
		"vscode": {
			"settings": {},
			"extensions": [
				"ms-python.python",
				"ms-python.vscode-pylance",
				"ms-toolsai.jupyter",
				"ms-toolsai.datawrangler",
				"shd101wyy.markdown-preview-enhanced"
			]
		}
	},
    "mounts": [
        "source=${localEnv:USERPROFILE}/Desktop/nwtimetracking/,target=/home/nwtimetracking/,type=bind,consistency=cached"
    ]	
}

As far as I know and at the moment of writing:

  • {localEnv:USERPROFILE} works only for Windows
  • {localEnv:HOME} works only for Linux/MacOS

Feature Request

If would be nice to have some kind of conditional logic that allows the use of both dynamically, according to the OS on which VSCode is running at the moment. Or a combo label that identifies the DESKTOP on all the supported OSes. Or similar solution.

Or if you are aware of a workaround for this issue, I would be glad to know!

Thank you!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.