-
Notifications
You must be signed in to change notification settings - Fork 226
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
Proposal: Predefined variables for user's home directory #335
Comments
Hi 👋 Thanks for opening the issue.
Based on the OS, @AngellusMortis can you double check if |
They exist on the host machine but are not existing inside of the of VS Code or PyCharm/Jetbrains Gateway. Both within the context of cloning the repo inside of a volume. If it is happening within the Docker "host" VM, I am guessing it is because it is not initializing the user envs correctly inside of the VM. But this is not the first time I have encountered env issues with devcontainers. Way back when they first started with VS Code, there is a bug/issue where it would not initialize your profile correctly on Windows with WSL. I understand you want to try to use the most "standard" solutions to implement global envs and such, but a user's home directory is pretty critical variable that would great to codify into the standard to ensure it is available even if the profile discovery fails / does not run as expected in some cases (like running inside of a Docker Desktop VM on a Windows machine). |
Thanks for the detailed response.
It would be great to narrow down this issue to a CLI vs Dev Containers Extension vs a VS Code/Py Charm issue. Did you try using the It would be great if we can update the CLI and somehow compute the home directory without depending on the host environment variables. However, as the home directory is customizable, I cant think of a standard way which will be compatible with all use cases. Thanks for asking this question, would be an interesting investigation. Let us know if you have any thoughts. Looping in @chrmarti for additional thoughts. |
So, I did notice a typo and I started doing more testing. It looks like the issue may have actually been some weird caching. The "Clone Repository in Container Volume" seems to have been re-using the existing container volume regardless if I had deleted the old volume with the code cloned on it. So that seems to have resolved the issue with the env not existing, it was probably a typo in an earlier version of the devcontainer config. I do still think a platform independent way of way of definitely common envs is a good idea though. Having to specify both variables is kind of annoying, but my main blocking issue is "fixed". However, I did just encounter a new issue since that is finally working. It looks like I can move it to a new issue, but figured I would mention it here since you are likely looking at this thread at the moment. Though it probably needs to be moved to a VS Code Dev Containers repo somewhere. Using Windows 11 22H2 (build 22621.2428) with VS Code 1.83.1 and Docker Desktop 4.22.1. Config: "workspaceFolder": "/home/vscode/dev",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/vscode/dev,type=bind,consistency=cached", Log snippnet:
Test repo to reproduce: https://github.com/AngellusMortis/test-devcontainer Full Logs: https://gist.github.com/AngellusMortis/594326ce92bc52970e64b95b78824f64 You can see there is no reference to It also only happens with the "Clone Repository in Container Volume" feature in VS Code so I assume it is a VS Code issue (well issue with the extension). Looking at the CLI docs, this definitely looks like a VS Code issue, not a devcontainers CLI issue (as seen in the log snippet above as well). Just let me know what repo to move the issue over to if you want. |
It also turns out that JetBrains IDEs do not handled the empty envs. |
|
Problem is that there are cases where you need to set |
We are running into a bunch of issues trying to support all of the use cases for devcontainers:
The main hurdle we are hitting is the fact that Windows has a different env for the Home directory then Linux/Mac. If you are doing 1 or 3, it does not matter as much because for Windows you can do from within WSL first. Codespaces is always Linux.
I have seen some other people use both envs but that is still often resulting in a blank env that generates an error:
results in the following if I do "Clone Repository into Container Volume" straight from VS Code on Windows:
Having a cross-platform and always defined way of providing the user's home directory on the host machine would help a ton.
(we are getting around the mount point not always existing with an initializeCommand)
The text was updated successfully, but these errors were encountered: