"ENV" randomly added to environment variables that originate from features can prevent container from starting
See original GitHub issueCurrently if you add both the node and python features, the container will fail to start properly in Remote - Containers stable.
In CLI 0.10.1, try building using this devcontainer.json…
{
"image": "mcr.microsoft.com/vscode/devcontainers/base:0-bullseye",
"features": {
"node": "latest",
"python": "os-provided"
}
}
Now, start the container using the image that was built but specify /bin/bash
as the entrypoint:
docker run -it --rm <image-id> /bin/bash -c 'echo ${PATH}'
You will get…
/usr/local/python/bin:/usr/local/share/nvm/current/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binENV:/usr/local/py-utils/bin:/root/.local/bin
The ENV
is smashed up against /bin
(becoming /binENV
) which prevents anything under the /bin
folder, including bash, from being found.
With 0.11.1 or using the new dev container features via OCI, you will instead see a hang after the installation of Python followed eventually by lots of errors about chown
… possibly caused by the same type of thing.
{
"image": "mcr.microsoft.com/vscode/devcontainers/base:0-bullseye",
"features": {
"ghcr.io/devcontainers/features/node": "latest",
"ghcr.io/devcontainers/features/python": "os-provided"
}
}
Build result:
...
#0 46.35 Updating /etc/bash.bashrc and /etc/zsh/zshrc...
#0 141.7 chmod: cannot access '/usr/local/share/nvm/test/fast/Listing': No such
file or directory
#0 141.7 chmod: cannot access 'versions': No such file or directory
#0 141.7 chmod: cannot access '/usr/local/share/nvm/test/fast/Listing': No such
file or directory
...
Issue Analytics
- State:
- Created a year ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
Troubleshoot issues when passing environment variables to ...
I want to troubleshoot issues when passing environment variables to my Amazon Elastic Container Service (Amazon ECS) task.
Read more >Environment variables in Compose | Docker Documentation
Substitute environment variables in Compose files. If you have multiple environment variables, you can substitute them by adding them to a default environment...
Read more >Pass Docker Environment Variables During The Image Build
ENV values are accessible during the build, and afterwards once the container runs. You can set ENV values in your Dockerfile - either...
Read more >env file is not read · Issue #4223 · docker/compose - GitHub
I ran into the same issue. The environment variables are set within the container itself and is accessible via the environment block. Maybe ......
Read more >Container environment variables - Visual Studio Code
You can set environment variables in your container without altering the ... Dockerfile or image: Add the containerEnv property to devcontainer.json to set ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I verified that ENV doesn’t get randomly added now. For the second JSON example, I get the error “Expected feature identifier to contain only alphanumeric and/or the ‘-’ characters.” in the editor on Windows, because “ghcr.io/devcontainers/features/node” contains slashes.
Published a new Feature release with the fix! 🚀 https://github.com/devcontainers/features/issues/110#issuecomment-1224806955