sparanoid/live-dl

[Feature Request] Add support for inheriting user and group permissions

begna112 opened this issue · 0 comments

When running this in docker(-compose), it natively runs as root. This can cause some pretty unfortunate permissions issues when trying to later interact with those files as it will even override ACLs and setgid bits.

Could this be adapted to inherit a user and group id to avoid this? Spent some time hunting down ways of doing it, but its a bit over my head to push it over the finish line.

The method used by linuxserver.io is likely way to complex to implement and relies on their base images and another package when manages some of the permissions. I wasn't quite able to figure out how. https://github.com/just-containers/s6-overlay

Another Youtube-DL package which doesnt have any live or scheduling functions is a bit simpler, but is implemented in Bash before executing python. https://github.com/mikenye/docker-youtube-dl/blob/master/init#L44-L73

I think that something like this might work in your existing dockerfile, but have not been able to test it. Blatantly stolen from another dockerfile somewhere.

RUN \
 groupmod -g $PGID users && \
 useradd -u $PUID -U -d /config -s /bin/false abc && \
 usermod -G users abc
USER abc

PGID and PUID would need to be set as environment variables to the container in something like this:

x-defaults: &defaults
  image: sparanoid/live-dl:latest
  restart: always
  environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
  volumes:
    - ${DOCKER_APPDATA}/live-dl/config.yml:/opt/live-dl/config.yml
    - ${DOCKER_APPDATA}/live-dl/youtube.com_cookies.txt:/opt/live-dl/cookies.txt
    - /Torrents/live-dl:/opt/live-dl/downloads

If you've got a better way, please do.