microsoft / microsoft/vscode-remote-release
Fail fast when `devcontainer.json` uses unsupported variables
@chrmarti is already working on this.
Since Sep 6, 2021.
- Dominant language
- Dockerfile
- Stars
- 4.2k
- Forks
- 470
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
Relates to #2888
As described by https://code.visualstudio.com/docs/remote/devcontainerjson-reference#_variables-in-devcontainerjson some variables (currently ${localWorkspaceFolder} and ${localWorkspaceFolderBasename}) are not available in devcontainer.json when cloning a repository (instead of opening a local folder).
It appears the Remote Containers extension does not detect this and passes the variable strings literally to Docker which then results in cryptic errors such as:
[34806 ms] Remote-Containers server terminated (code: 137, signal: null).
docker: Error response from daemon: create ${localWorkspaceFolder}/hex/spec: "${localWorkspaceFolder}/hex/spec" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.
See 'docker run --help'.
Since one of the main purposes of this extension is to simplify starting development on a new project, having such an error is pretty awful.
Could the extension please detect usage of such unsupported variables and fail fast, with a proper error message, before trying to start docker?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.