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:TEST_VAR} does not work with mounts #7147

Closed
tvenhaus opened this issue Sep 1, 2022 · 1 comment
Closed

${containerEnv:TEST_VAR} does not work with mounts #7147

tvenhaus opened this issue Sep 1, 2022 · 1 comment
Labels
containers Issue in vscode-remote containers

Comments

@tvenhaus
Copy link

tvenhaus commented Sep 1, 2022

Environment:

  • VSCode Version: 1.71.0-insider (user setup)
  • Local OS Version: Windows 11
  • Remote OS Version: Ubuntu (though any will work)
  • Remote Extension/Connection Type: Containers

Steps to Reproduce:

  1. Create a new folder and open in VS Code
  2. Add Dev Container configuration files (choosing Ubuntu)
  3. Create /.devcontainer/devcontainer.env file:
TEST_VAR=/mnt/c/LocalFolder
  1. Add the following to the devcontainer.json file:
"runArgs": ["--env-file",".devcontainer/devcontainer.env"],
"mounts": [
	"source=${containerEnv:TEST_VAR},target=/remotefolder,type=bind,consistency=cached"
]
  1. Rebuild and Open in Container
  2. Observe Error
    docker: Error response from daemon: invalid mount config for type "bind": invalid mount path: '${containerEnv:TEST_VAR}' mount path must be absolute.

May be related to this issue.

@github-actions github-actions bot added the containers Issue in vscode-remote containers label Sep 1, 2022
@chrmarti
Copy link
Contributor

chrmarti commented Sep 6, 2022

The mount points are applied when the container is created, but container variables (containerEnv) are only replaced after the container is created. This is because only after the container was created can we inspect the container for its environment variables.

Hope that makes sense. Closing as expected. Thanks.

@chrmarti chrmarti closed this as completed Sep 6, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
containers Issue in vscode-remote containers
Projects
None yet
Development

No branches or pull requests

2 participants