VITIMan / docker-music-stack

A fully working music stack built over Docker. Icecast + MPD + sima + ympd
81 stars 28 forks source link

MPD container can't initialize music library correctly #3

Open tengufromsky opened 5 years ago

tengufromsky commented 5 years ago

I trying start mpd container via docker-compose:

version: '3'
services:
    mpd:
      image: vitiman/alpine-mpd:latest
      ports:
        - "6600:6600"
        - "8800:8800"
      volumes:
        - ./music:/var/lib/mpd/music
        - ./playlists:/var/lib/mpd/playlists
        - ./database:/var/lib/mpd/database
      devices:
        - /dev/snd

I assume, that ./music directory on my host contains music, but i don't create ./playlists and ./database folders, because i did not use mpd directly in the host before. On container startup folders ./playlists and ./database created with root ownership, but MPD container show me erros:

errno: Failed to open /var/lib/mpd/database/tag_cache: No such file or directory
fatal_error: Can't create db file in "/var/lib/mpd/database": Permission denied

Do you have any solving ideas?

Gulluth commented 5 years ago

mpd runs as the mpd user, so since the directory is owned by root the application running inside the container cannot write to the database directory. I fixed it using chmod on the database directory, but there are more secure ways to fix this.