Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail fast when devcontainer.json uses unsupported variables #5547

Open
Marcono1234 opened this issue Sep 3, 2021 · 1 comment
Open

Fail fast when devcontainer.json uses unsupported variables #5547

Marcono1234 opened this issue Sep 3, 2021 · 1 comment
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug containers Issue in vscode-remote containers plan-review PM-highlighted item determined to be P1 or P2 volume Dev Container mounting a Docker volume

Comments

@Marcono1234
Copy link

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?

@github-actions github-actions bot added the containers Issue in vscode-remote containers label Sep 3, 2021
@chrmarti chrmarti self-assigned this Sep 6, 2021
@chrmarti chrmarti added the bug Issue identified by VS Code Team member as probable bug label Sep 6, 2021
@bamurtaugh bamurtaugh added the plan-review PM-highlighted item determined to be P1 or P2 label Sep 28, 2021
@James-Mart
Copy link

Strangely enough, I use ${localWorkspaceFolderBasename} in my mount parameters, and it works just fine for me:
"mounts": ["source=${localWorkspaceFolder}/artifacts,target=/root/.../build/artifacts,type=bind"],

I didn't even know it wasn't supposed to work, until a friend of mine tried to use my exact same devcontainer.json and he got the error message listed above: ...If you intended to pass a host directory, use absolute path.

Anyone have any idea why it is actually working for me?

@chrmarti chrmarti added the volume Dev Container mounting a Docker volume label Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug containers Issue in vscode-remote containers plan-review PM-highlighted item determined to be P1 or P2 volume Dev Container mounting a Docker volume
Projects
None yet
Development

No branches or pull requests

4 participants