microsoft / microsoft/vscode-remote-release

Support using config variables in devcontainer.json

Open
#3,541 1 comment 11 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I would like to be able to refer to a custom value specified in settings.json inside the devcontainer.json.

For example, if I have the following as an entry in my user-level settings.json:

"my.data_dir": "X:/"

I would like to be able to have:

"mounts": [
    "src=${localConfig:my.data_dir},dst=/mnt/data,type=bind"
]

It should be possible to use this in build.args or runArgs or anywhere else that variables are currently supported. This would allow each user to put these files in a different path.

Current workaround is to put the value in the environment instead and use ${localEnv:MY_DATA} but this seems less elegant as it pollutes all other apps on the system.

This suggestion is intended to mirror ${localConfig:x} to ${config:x} in tasks.json/launch.json similar to how ${localEnv:x} mirrors ${env:x}.

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.

Research direction

Start by tracing the existing variable expansion used by devcontainer.json, especially ${localEnv}, and how values from settings.json are read. Review the requested mounts example along with build.args and runArgs; done means a user-level setting can be referenced consistently wherever variables are currently supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, vscode
Domain
developer-experience, devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.