Skip to content

fix: set workspace default as ${containerWorkspaceFolder} #17

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mafredri
Copy link
Member

No description provided.

Copy link

@ankudinov ankudinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested that on my setup - it's much better option for dev containers as otherwise coder settles in home directory that has nothing to do with the real workspace
this is a very helpful default as it prevents hardcoding the path

@mafredri
Copy link
Member Author

@ankudinov thank you for the feedback! The reason this hasn't been merged is that, unfortunately, for features the default value containing ${containerWorkspaceFolder} does not get interpolated. I.e. it becomes the literal string for ${containerWorkspaceFolder} 😔.

I recall trying to find a workaround, but AFAICT there is no way to access ${containerWorkspaceFolder} within a feature.

PS. Out of interest, are you using this feature within coder/coder or in some other environment?

@ankudinov
Copy link

@mafredri yes, the ${containerWorkspaceFolder} fails for pre-build or similar unfortunately. It worked well for the normal devcontainer build however. Honestly I can't imagine a good workaround that will work for all cases. My review was more on standalone container build where it worked well.
Alternatively keep the old default or make this variable mandatory?

I'm not using coder/coder, but our own prebuilt container which is based on official Python image originally.
It's all in experimental phase right now and I'm stepping into some issues. Including ${containerWorkspaceFolder} being a string and extensions not installed. Happy to provide some feedback when it's closer to prod phase.
The workspace will be most likely simply fixed to a specific path.

@mafredri
Copy link
Member Author

mafredri commented Aug 19, 2025

@ankudinov I see you specified it in the projects devcontainer.json, so it makes sense that it worked there. However if used in a feature it won't work whether it's a normal build or pre-build, at least from what I recall testing this.

I forgot this but we're using $_REMOTE_USER_HOME as a default when no workspace folder is set. It works in our use in coder/coder devcontainer.json, but this seemingly doesn't work in your use? I wonder if you could be running into this issue: devcontainers/cli#331 or something similar? I see you specified containerUser, maybe that could be interfering with the env?

EDIT: I also forgot we override the app to set the ?folder=${containerWorkspaceFolder}, so maybe that's actually what fixes it for us 😅. Perhaps making it mandatory is the best option. 👍🏻

PS. Thanks for sharing your use-case. Definitely interested in learning more about it. 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants