Environment Variable created in postCreateCommand of devcontainer.json not persisted #7016
Labels
containers
Issue in vscode-remote containers
feature-request
Request for new features or functionality
Milestone
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
: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 text was updated successfully, but these errors were encountered: