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

${containerEnv:ENV_VAR:default_value} not working #7121

Closed
aeschli opened this issue Aug 25, 2022 · 2 comments · Fixed by devcontainers/cli#146
Closed

${containerEnv:ENV_VAR:default_value} not working #7121

aeschli opened this issue Aug 25, 2022 · 2 comments · Fixed by devcontainers/cli#146
Assignees
Labels
candidate Issue identified as probable candidate for fixing in the next release containers Issue in vscode-remote containers verified Verification succeeded
Milestone

Comments

@aeschli
Copy link
Contributor

aeschli commented Aug 25, 2022

Testing #7100

  • open a new folder, create a new devcontainer file (e.g. Ubuntu)
  • add "postCreateCommand": "echo XXX ${localEnv:PATH:NO_PATH} ${localEnv:PATH1:NO_PATH1}",
  • run the container. Works
[5207 ms] Start: Run in container: /bin/sh -c echo XXX /home/aeschli/.local/bin:/home/aeschli/.... NO_PATH1
XXX /home/aeschli/.local/bin:/home/aeschli/... NO_PATH1

change localEnv to containerEnv:
"postCreateCommand": "echo XXX ${containerEnv:PATH:NO_PATH} ${containerEnv:PATH1:NO_PATH1}",

  • rebuild container
[5199 ms] Start: Run in container: /bin/sh -c echo XXX ${containerEnv:PATH:NO_PATH} ${containerEnv:PATH1:NO_PATH1}
/bin/sh: 1: Bad substitution
@tanhakabir tanhakabir added the containers Issue in vscode-remote containers label Aug 26, 2022
@chrmarti chrmarti added this to the August 2022 milestone Aug 29, 2022
@chrmarti chrmarti added the candidate Issue identified as probable candidate for fixing in the next release label Aug 29, 2022
@tvenhaus
Copy link

tvenhaus commented Sep 1, 2022

I just tested version v0.250.0 using the VSCode Insiders build and observed that container environment variables (i.e. ${containerEnv:ENV_VAR:default_value) are still not working when used within the "mounts" property.

"mounts": [
	"source=${containerEnv:SOME_VAR},target=/some/folder,type=bind,consistency=cached"
],

This results in the following error:

docker: Error response from daemon: invalid mount config for type "bind": invalid mount path: '${containerEnv:SOME_VAR}' mount path must be absolute.

@aeschli
Copy link
Contributor Author

aeschli commented Sep 1, 2022

Verified with v0.252.0

@aeschli aeschli added the verified Verification succeeded label Sep 1, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
candidate Issue identified as probable candidate for fixing in the next release containers Issue in vscode-remote containers verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants