microsoft / vscode-dev-containers

NOTE: Most of the contents of this repository have been migrated to the new devcontainers GitHub org (https://github.com/devcontainers). See https://github.com/devcontainers/template-starter and https://github.com/devcontainers/feature-starter for information on creating your own!
https://aka.ms/vscode-remote
MIT License
4.72k stars 1.41k forks source link

Add list of folders to create as part of common setup script. #1588

Closed Clockwork-Muse closed 1 year ago

Clockwork-Muse commented 2 years ago

Relates to: Both

When creating containers, one of the common things to do is to create folders that will be mounted to avoid extension re-installs. The problem is that this really requires creating the folders in the Dockerfile (and potentially the non-root user), which must occur before the common script is run as part of the "feature" call.

Now, clearly, it's possible to download (and run) the common setup script during the dockerfile run, meaning that at least the user is created properly... but that then removes the benefit of the feature section entirely. It would be nice if, instead, there was a list of folder (paths) that the script would create and chown/chmod as appropriate.

The specifically is a request to not to provide a setting for the extension/vscode directories because:

For the latter point, mounted directories where the target does not already exist are created with root permissions, which causes havoc with extension install, and possibly other cases as well. Too, there is no lifecycle command available in the devcontainer.json format that executes after container creation but before volume mounting, so creating these directories via a loaded setup script is not viable - the directories have already been mounted/created, and the script executes "too late".

bamurtaugh commented 2 years ago

cc @chrmarti @samruddhikhandale would this be affected by https://github.com/devcontainers/features/issues/67?

chrmarti commented 1 year ago

I think these folders can be created as part of the Dockerfile or with a feature script. They are not needed by other feature scripts. (So the existing common script should not be affected.)

Chuxel commented 1 year ago

@bamurtaugh @chrmarti Yeah this sounds a bit more like a devcontainer spec request. There's nothing in the contents of this repository that could do this on its own.

@Clockwork-Muse Would you mind creating a request at https://github.com/devcontainers/spec ?

Clockwork-Muse commented 1 year ago

... I think I'm actually going to close without creating an issue there:

Possibly an issue should be raised here if having vscode cache extensions on its own, external from the spec is desired.