Everything works as expected. But I can’t open /data/docker/homeassistant in vscode and edit files cause everything in /data/docker/homeassistant is root:root.
The quick/easy fix seems to be to set the PUID/PGID environment variables to 1000 which is my primary user.
As a possible alternative, you could change the permissions of the files, either by making them writable for everyone, or by adding yourself to group “root” and make the files group-writable (a bit more safe).
Setting PUID/PGID could also work, but is more likely to break things.
Indeed, and specially: When you restart the container, most files will be reset to root:root, leaving you with a weird mix. Best to just leave it. I’ve tried.
This is the best option. I personally don’t edit files directly, but have an rsync script, so I don’t have exact knowledge of the VSCode app (add-on).
not sure why but HA docker container didnt respect puid/pgid or pid/gid. it did recognize and utilize “user”. the user will be unknown to docker container but services will run as user.
I have not checked puid/guid in past 1 to 2 yrs so maybe this has changed. I am running recent HA version so I have confirmed “user” is functioning and may resolve your file permission issue.
EDIT
and yes, if i remember setting PUID/PGID or variants did break things or maybe it just had no effect. tested long ago and did not document problems