Always install extensions to support mounting the home folder
Issue type: feature request
Description
We use dev container and we mount local folder from docker host into the user's home folder inside the container (eg. '/root/`).
The file /root/.vscode-server/data/Machine/.installExtensionsMarker is created every time we start our dev container and that prohibits us to install additional extensions. In case the file exist no extension is installed to prevent altering the container.
I did not see any issue regarding extension installation so I do not understand why the .installExtensionsMarker file is not deleted during dev container startup.
Actual behavior
We need to remove the marker file with a script using the initializeCommand or the postCreateCommand to allow new extension to be installed.
Expected
The extensions shall be installed on the mounted home folder in the following case:
- we extend the list of extensions in the .devcontainer.json (eg.: by updating the git repository),
- we add some extension manually.
VSCode:
Version: 1.57.0 (user setup) Commit: b4c1bd0a9b03c749ea011b06c6d2676c8091a70c Date: 2021-06-09T17:18:42.354Z Electron: 12.0.9 Chrome: 89.0.4389.128 Node.js: 14.16.0 V8: 8.9.255.25-electron.0 OS: Windows_NT x64 10.0.18363
Original topic from a different issue
@neuromechanist It looks like
/root/.vscode-server-insiders/data/Machine/.installExtensionsMarkeralready existed (and we therefore skipped the extension install). Did you mount anything there or a parent folder?Originally posted by @chrmarti in https://github.com/microsoft/vscode-remote-release/issues/3975#issuecomment-723872103
The last time I was checking this issue, I noticed that this marker only gets added after the extension install is complete. So, chances are that the folder already existed in the image you mounted.
That's why every time I spun up the image, I would have seen this error.
A way to check if this is the case for you too is to mount the image outside vscode and see if the folder exists in your image. If so, creating an image after deleting the whole .vscode-server-insiders should solve your problem.
We always need to delete the marker on the local filesystem (that is mounted as /root/) before we start the dev container to allow new extension to be installed and after the container is started the marker is created. So no additional extension gets installed on the following start or even in case we try to add some extension manually.
According to @chrmarti link
The marker file is created at the start of the extension installation. If the installation fails and you reload the window, it will not retry. That is to not block startup forever. You can then rebuild the container to retry extension installation.
/root/.vscode-server-insiders contains data related to the container. Could you make that folder part of the container's own filesystem? (A Linux bind mount might be needed for that if /root is mounted on a Windows filesystem.)
We would like to avoid extension installation on container rebuild but we would like to delete it (the /root/.vscode-server* folder) in case needed or keep them separate from different dev container setup.
The /root folder contains the developer's own the VS Code setting and azure, docker kubernetes authorizations for a given project. For a different project we use different dev container and so also different home folder (/root).
Yes, the host system is Windows and so is the home folder we mount under dev container as /root.
Please give me feedback to support in case more information is needed.
Maybe it is important to note: that I support people in corporate environment to getting started with dev containers, many of them are not experienced with Linux environment. So they need to store there source and local setting on local system in order to trust and keep them feel confident, they don't loose there works. For me a volume would suffice.
If you want to avoid extension installation on rebuild, you'll need to keep the .installExtensionsMarker file. It sounds like you want the first, but not the second?
We mount the local "home" folder and if the extensions are already there no installation takes place, not even after container rebuild.
The marker file prevents the installation of new extension added to .devcontainer file after the first container startup.
What is the use case where we need this marker file?
How does the marker file work, what does it do exactly?
It is meant as a marker for the container. When you mount the home folder, the marker outlives the container. We just place it there to remember that extensions have already been installed.
What is the intended use of the marker file with home folder mounted to devcontainer? Can we disable it some how?
There is no setting to disable it. When you have the home folder mounted, you also carry forward the extensions installed at /root/.vscode-server-insiders/extensions. You could try deleting the marker file in the devcontainer.json's "postCreateCommand".
That is exactly what I tied to explain :)
We remove the marker file with a script using the initializeCommand to allow new extension to be installed. That is a workaround and I would like to get a solution for that.
Would you like it to just always install the listed extensions (if they aren't installed yet)? It would not uninstall any extensions (it wouldn't know which ones).
Sorry, I don't get your comment, does the following answer your question:
- We list the needed extensions in the .devcontainer.json (included in git repository) and we may update that time to time.
- We also add some extension manually.
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 10 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!