sentriz / gonic

music streaming server / free-software subsonic server API implementation
ircs://irc.libera.chat/#gonic
GNU General Public License v3.0
1.49k stars 105 forks source link

Allow setting user for docker image #506

Closed ismay closed 1 month ago

ismay commented 1 month ago

For docker containers that place files on the host it's nice to be able to define the user. Currently files that gonic creates are owned by root. Similar to for example how https://www.navidrome.org/docs/installation/docker/ accepts the user parameter for their docker images.

mstcl commented 1 month ago

I might be wrong but I don't think gonic requires any root privileges while running? Which means you should be able to use the user docker directive to control the runtime UID and GID as usual.

I'm able to run gonic with -u 1000:1000 (for docker run) and user: 1000:1000 (for docker compose) without any problems. You only have to make sure the database have the right permissions.

ismay commented 1 month ago

I might be wrong but I don't think gonic requires any root privileges while running? Which means you should be able to use the user docker directive to control the runtime UID and GID as usual.

I'm able to run gonic with -u 1000:1000 (for docker run) and user: 1000:1000 (for docker compose) without any problems. You only have to make sure the database have the right permissions.

I tried and got a db error. But that might have been because it had already been created. Not sure.

mstcl commented 1 month ago

Have you checked if the user is the owner or has write permission for both the sqlite file and the directory the file is in?

ismay commented 1 month ago

Have you checked if the user is the owner or has write permission for both the sqlite file and the directory the file is in?

Sorry I haven't, I've since moved to navidrome. Feel free to close if you don't want to leave this open without further feedback.