microsoft / microsoft/vscode-remote-release

Fail fast when `devcontainer.json` uses unsupported variables

Open
#5,547 1 comment 0 reactions 1 assignee View on GitHub

@chrmarti is already working on this.

Since Sep 6, 2021.

bug containers plan-review volume
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

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.