pltnk / docker-liquidsoap

Dockerfile for running Liquidsoap in a container.
https://hub.docker.com/r/pltnk/liquidsoap
MIT License
11 stars 9 forks source link

Read permission denied for music volume #12

Closed leolobato closed 2 years ago

leolobato commented 2 years ago

Thank you for taking the time to setup this docker container.

I've tried replacing my standalone liquidsoap setup by this container (use Portainer) but am running into the following issue, only for the /music volume:

2022-09-26T21:29:03.727207000Z 2022/09/26 21:29:03 >>> LOG START
2022-09-26T21:29:03.727809000Z 2022/09/26 21:29:03 [main:3] Liquidsoap 2.0.3-1
2022-09-26T21:29:03.727964000Z 2022/09/26 21:29:03 [main:3] Using: graphics=[distributed with Ocaml] bytes=[distributed with OCaml 4.02 or above] pcre=7.4.6 sedlex=3.0 menhirLib=20211128 dtools=0.4.4 duppy=0.9.2 cry=0.6.7 mm=0.7.4 ogg=0.7.3 ogg.decoder=0.7.3 vorbis=0.8.0 vorbis.decoder=0.8.0 mad=0.5.2 dynlink=[distributed with Ocaml] lame=0.3.6 samplerate=0.1.6 taglib=0.3.10 camomile=1.0.2
2022-09-26T21:29:03.728085000Z 2022/09/26 21:29:03 [dynamic.loader:3] Could not find dynamic module for fdkaac encoder.
2022-09-26T21:29:03.728198000Z 2022/09/26 21:29:03 [clock:3] Using builtin (low-precision) implementation for latency control
2022-09-26T21:29:03.728314000Z 2022/09/26 21:29:03 [lang:2] WARNING: "set" is deprecated and will be removed in future version. Please use `settings.path.to.key.set(value)`
2022-09-26T21:29:03.728410000Z 2022/09/26 21:29:03 [frame:3] Using 44100Hz audio, 25Hz video, 44100Hz main.
2022-09-26T21:29:03.728509000Z 2022/09/26 21:29:03 [frame:3] Video frame size set to: 1280x720
2022-09-26T21:29:03.728620000Z 2022/09/26 21:29:03 [frame:3] Frame size must be a multiple of 1764 ticks = 1764 audio samples = 1 video samples.
2022-09-26T21:29:03.728719000Z 2022/09/26 21:29:03 [frame:3] Targeting 'frame.duration': 0.04s = 1764 audio samples = 1764 ticks.
2022-09-26T21:29:03.728815000Z 2022/09/26 21:29:03 [frame:3] Frames last 0.04s = 1764 audio samples = 1 video samples = 1764 ticks.
2022-09-26T21:29:03.728910000Z 2022/09/26 21:29:03 [sandbox:3] Running inside a docker container, disabling sandboxing.
2022-09-26T21:29:03.729010000Z 2022/09/26 21:29:03 [video.converter:3] Couldn't find preferred video converter: ffmpeg.
2022-09-26T21:29:03.729106000Z 2022/09/26 21:29:03 [audio.converter:3] Using samplerate converter: libsamplerate.
2022-09-26T21:29:03.729203000Z 2022/09/26 21:29:03 [single_0:3] /etc/liquidsoap/bisorofm.mp3 is static, resolving once for all...
2022-09-26T21:29:03.745039000Z 2022/09/26 21:29:03 [single_0:3] Prepared "/etc/liquidsoap/bisorofm.mp3" (RID 4).
2022-09-26T21:29:03.745211000Z 2022/09/26 21:29:03 [Bisoro_FM:3] Connecting mount stream for source@bisoro.club...
2022-09-26T21:29:03.897988000Z 2022/09/26 21:29:03 [Bisoro_FM:2] Connection failed: SSL transport is not available
2022-09-26T21:29:03.898358000Z 2022/09/26 21:29:03 [Bisoro_FM:3] Will try again in 3.00 sec.
2022-09-26T21:29:03.898776000Z 2022/09/26 21:29:03 [clock.main:3] Streaming loop starts in auto-sync mode
2022-09-26T21:29:03.899026000Z 2022/09/26 21:29:03 [clock.main:3] Delegating synchronisation to CPU clock
2022-09-26T21:29:03.900856000Z 2022/09/26 21:29:03 [request:3] Read permission denied for "/music/VG Soundtrack/Gameboy/DMG Sound - Volume 2/19 - Battle! (Champion) - Pokémon Gold & Silver Versions.mp3"!
2022-09-26T21:29:03.901415000Z 2022/09/26 21:29:03 [request:3] Read permission denied for "/music/VG Soundtrack/Gameboy/DMG Sound - Volume 1/14 - Pokémon Mansion - Pokémon.mp3"!

This is my docker compose file:

---
version: "3.6"
services:
  liquidsoap:
    image: pltnk/liquidsoap
    container_name: liquidsoap
    restart: always
    volumes:
      - /portainer/Files/AppData/Config/liquidsoap:/etc/liquidsoap
      - /mnt/music/Radio:/music

If I use the console into the container and try to access the /music mounted volume, I do get access denied.

pltnk commented 2 years ago

Hi there!

In the container Liquidsoap runs under a non-root user, so I'm guessing it has something to do with file permissions. What permissions does your /mnt/music/Radio directory have? Does issuing this command chmod -R 774 /mnt/music/Radio help?

leolobato commented 2 years ago

I was able to solve it by changing the UID of the radio user created by the Dockerfile, to match the UID of my host system.

Before my fix, it would show (inside the container):

radio@2d39eeb652eb:/$ ls -la /     
total 60
...
drwxrwx---   2  1000  1000    0 Apr 17 07:43 music
...

So I modified the Dockerfile to use this UID/GID:

RUN groupadd -g 1000 radio && \
    useradd -m -r -u 1000 -s /bin/bash -g radio radio && \

And then recreated the docker image from this local copy and it worked:

radio@2d39eeb652eb:/$ ls -la /     
total 60
...
drwxrwx---   2 radio radio    0 Apr 17 07:43 music
...

There should be some better, automated way to do this but I'm not super familiar with Docker.

pltnk commented 2 years ago

Looks like your /mnt/music/Radio directory doesn't have read permission set for all users. So the command chmod -R 774 /mnt/music/Radio issued from the host system (not from the inside of the container) would also help to resolve this.