question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"ENV" randomly added to environment variables that originate from features can prevent container from starting

See original GitHub issue

Currently 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:closed
  • Created a year ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
rzhao271commented, Aug 26, 2022

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.

1reaction
samruddhikhandalecommented, Aug 23, 2022

Also - the v2 hang in this scenario is still there, correct? Do we want to fork this issue for that part?

Published a new Feature release with the fix! 🚀 https://github.com/devcontainers/features/issues/110#issuecomment-1224806955

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found