devcontainers / spec

Development Containers: Use a container as a full-featured development environment.
https://containers.dev
Creative Commons Attribution 4.0 International
3.61k stars 231 forks source link

Some features edit `.bashrc` and `.zshrc`, such as [stuartleeks/shell-history](https://github.com/stuartleeks/dev-container-features/blob/main/src/shell-history/README.md) which needs to `chown` a folder that is mounted. #374

Open bgu5678 opened 10 months ago

bgu5678 commented 10 months ago

Some features edit .bashrc and .zshrc, such as stuartleeks/shell-history which needs to chown a folder that is mounted.

The issue I'm experiencing comes when I use my custom dotfiles repo, which replaces any .zshrc files with a custom one, so any changes made from features are basically deleted.

Do you have any idea on how to fix this? I could source the old .zshrc in my custom file, but I'm not sure if that's a good idea. I was also thinking that there can be a "best practice" for devcontainer features to add stuff to .zshrc.devcontainers (and so on for bash and fish) so people can take this into account when making install scripts for devcontainer dotfiles.

Originally posted by @joshuanianji in https://github.com/devcontainers/spec/discussions/371

joshuanianji commented 10 months ago

Thanks for posting this @bgu5678, although I don't think this is an issue with the spec so this can be closed. The solution is probably to chown the folder during a lifecycle script (see: https://github.com/joshuanianji/devcontainer-features/issues/40). I'll first have test it with my features and see how it goes though!

If it works well, I might send a PR to a couple other features with volume mounts.