dmunozv04 / iSponsorBlockTV

SponsorBlock client for all YouTube TV clients.
GNU General Public License v3.0
2.17k stars 89 forks source link

Docker image crashes since 2.0.7 #164

Closed Shraymonks closed 2 weeks ago

Shraymonks commented 1 month ago

Describe the bug Docker image appears to be broken since 2.0.7. It immediately crashes upon running.

To Reproduce Steps to reproduce the behavior:

  1. Start docker container with 2.0.7 or 2.0.8 image.

Expected behavior Supposed to run normally.

iSponsorBlockTV server (please complete the following information):

Additional context

It immediately crashes with this:

Traceback (most recent call last):

  File "./main.py", line 1, in <module>

  File "./iSponsorBlockTV/helpers.py", line 8, in <module>

ModuleNotFoundError: No module named 'appdirs'

Is there an issue with the docker build that's changed since 2.0.6? Are the dependencies being installed differently?

dmunozv04 commented 1 month ago

Dependencies are being installed the same way, only change was a bump in versions. I've just tested running the latest linux/amd64 image and it runs fine for me; and the appdirs module is present on it. Please try running docker exec iSponsorBlockTV ls /root/.local/lib/python3.11/site-packages/ with iSponsorBlockTV being the name of your docker container and please post its output.

rifelpet commented 1 month ago

This issue is specific to running the container with a non-root user:

❯ docker run --user 1002:1002 -v $(pwd):/app/data -it --rm ghcr.io/dmunozv04/isponsorblocktv:v2.0.8
Traceback (most recent call last):
  File "./main.py", line 1, in <module>
  File "./iSponsorBlockTV/helpers.py", line 8, in <module>
ModuleNotFoundError: No module named 'appdirs'
❯ docker run -v $(pwd):/app/data -it --rm ghcr.io/dmunozv04/isponsorblocktv:v2.0.8
2024-06-01 14:33:35,369 - iSponsorBlockTV - INFO - Starting device

which worked in 2.0.6:

❯ docker run --user 1002:1002 -v $(pwd):/app/data -it --rm ghcr.io/dmunozv04/isponsorblocktv:v2.0.6
[06/01/24 14:34:34] INFO     YouTube on TV Starting device                                                                                                                     

likely as a result of https://github.com/dmunozv04/iSponsorBlockTV/commit/80196b19aade6041ddf75c46f97ff885715b55fc

exec'ing in as the non-root user reveals the lack of permissions:

❯ docker exec iSponsorBlockTV ls /root/.local/lib/python3.11/site-packages/

ls: /root/.local/lib/python3.11/site-packages/: Permission denied

but exec'ing in as the root user displays the packages as expected:

❯ docker exec --user root iSponsorBlockTV ls /root/.local/lib/python3.11/site-packages/

aiohttp
aiohttp-3.9.5.dist-info
aiosignal
aiosignal-1.3.1.dist-info
appdirs-1.4.4.dist-info
appdirs.pyc
...
dmunozv04 commented 1 month ago

Oh, that makes sense

Shraymonks commented 1 month ago

Is there a reason for moving the deps from /usr/local/ to /root/.local/ in https://github.com/dmunozv04/iSponsorBlockTV/commit/80196b19aade6041ddf75c46f97ff885715b55fc? That's why there's the permission issue.

dmunozv04 commented 1 month ago

Iirc it was done to be able to reduce the image size a bit, but reverting it should be just fine