marcel-dempers / docker-development-youtube-series

5.3k stars 4.09k forks source link

Mapping PWD to container changes file ownership on host system #192

Closed ashishjullia closed 1 year ago

ashishjullia commented 1 year ago

Hi @marcel-dempers

I know this (the title^) is expected but is there a way to preserve the host system file's/directory's ~permissions~ ownership user:group when mapping them from the host system to a container?

I tried looking online and was not able to find any relevant solution for this.

Thanks in advance.

marceldempers commented 1 year ago

I dont believe it changes ownership, it entirely depends what user is running as PID 1 in the container and if its root or something else, and that PID creates a new file, that file will be owned by that user. All existing files should remain unchanged unless its something your process in the container is changing. Hope that helps