Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addressing persistent volume permissions issue and default user creation inside the image #409

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

saicharan0112
Copy link

Currently the docker image has a default user "app" with the uid and gid set to 1000. this is causing difficulty in mapping the persistent storage from the host with a different uid and gid. Addressed in this issue #403. Not sure what exactly is the purpose of the default user inside the image.

I removed the default user creation and now the user & group gets created as part of the entrypoint script based on the uid and gid given from the docker run command as an env variable. The changes in this PR will take care of the user permissions of the directories mounted.

I am using this updated docker images in my homelab and I have no problem in using the blackcandy to play songs till now. Hope this is helpful

…the uid and gid values from the user for persistant storage creation
# Change ownership of the working directory
chown -R "$USER_ID":"$GROUP_ID" "$MEDIA_PATH"


Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point the container is running as root. One of the reasons to drop root is for more security.

Perhaps we can su the exec on line 23?

You can mount media files from host to container and use `MEDIA_PATH` environment variable to set the media path for black candy. You can now provide the uid and gid as env arguments so that the permissions of "<your_media_data_path>" is properly aligned with media path set for black candy above.

```shell
docker run -e UID=$(id -u) -e GID=$(id -g) -v <your_media_data_path>:/media_data -e MEDIA_PATH=/media_data ghcr.io/blackcandy-org/blackcandy:latest
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider updating the docker compose example as well.

VIRTUAL_HOST: blackcandy.local

@gardner
Copy link

gardner commented Jan 14, 2025

Nice work! I am not a maintainer on this project but I left a couple of comments to consider. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants