vscode-remote-release
vscode-remote-release copied to clipboard
Environment Variable created in postCreateCommand of devcontainer.json not persisted
- VSCode Version: Version: 1.69.2 (Universal)
- Local OS Version: MacOS Monterey
- Remote Extension/Connection Type: Containers
I am trying to assign an environment variable that takes the path of the container-host mounts to pass them on into a docker-compute that will be launched from the development container (using the docker-from-docker functionality). I attempt this using a postCreateCommand in the devcontainer.json:
{
...
"postCreateCommand": "export MOUNT_PATH=$(docker inspect $(hostname) | jq '.[0].HostConfig.Mounts' | jq '.[0].Source')"
...
}
However, I am not able to access the environment variable once the container has finished launching. $ echo $MOUNT_PATH returns nothing and it also does not show up when running $ printenv. The only way I can achieve this is to once again run the postCreateCommand manually, once the container is running.
Note: The command itself seems to be working, as "postCreateCommand": "echo MOUNT_PATH=$(docker inspect $(hostname) | jq '.[0].HostConfig.Mounts' | jq '.[0].Source')" does print the correct value to the command line during the container launch process.
The same issue can be observed with postStartCommand.
These commands are run in a separate shell. Marking as feature request.
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 10 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
This feature request has not yet received the 10 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.
Happy Coding
:slightly_frowning_face: In the last 60 days, this feature request has received less than 10 community upvotes and we closed it. Still a big Thank You to you for taking the time to create this issue! To learn more about how we handle feature requests, please see our documentation.
Happy Coding!