Skip to content

Spotifyd within a docker container for ARM (armv7/arm64) and x32/x64 architectures in configuration variants alsa/pulseaudio for audio-backend and with/without D-Bus API for controlling spotifyd through generic media players.

Notifications You must be signed in to change notification settings

hvalev/spotifyd-docker

Repository files navigation

Spotify Daemon in Docker

Alsa Alsa dbus Pulseaudio Pulseaudio dbus
Alsa Docker Pulls Alsa Docker Image Size (latest by date) Alsa Docker Pulls Alsa Docker Image Size (latest by date) Alsa Docker Pulls Alsa Docker Image Size (latest by date) Alsa Docker Pulls Alsa Docker Image Size (latest by date)

build spotifyd%20version

Spotifyd within a docker container for ARM (armv7/arm64) and x32/x64 architectures in configuration variants alsa/pulseaudio for audio-backend and with/without D-Bus API for controlling spotifyd through generic media players.

Insights

According to my subjective experience and available hardware, dbus in the alsa variant is better as it uses a software controller which appears to increase volume linearly. On the other hand the volume control with pure alsa renders anything below 60% practically unhearable and anything above 80% too loud. I haven't tested the pulseaudio version yet. Let me know if you have some feedback.

How to run the alsa variant

docker run -d --net host --group-add $(getent group audio | cut -d: -f3) --device /dev/snd:/dev/snd -v /usr/share/alsa:/usr/share/alsa -v $PWD/contrib/spotifyd.conf:/etc/spotifyd.conf hvalev/spotifyd-XXX where you need to replace XXX with the appropriate image in https://hub.docker.com/u/hvalev. or with docker-compose:

version: '3'
services:
  spotifyd:
    container_name: spotify
    restart: always
    image: hvalev/spotifyd-XXX
    network_mode: host
    devices:
      - /dev/snd:/dev/snd
    volumes:
      - /usr/share/alsa:/usr/share/alsa
      - /etc/spotifyd/spotifyd.conf:/etc/spotifyd.conf
      - /etc/asound.conf:/etc/asound.conf
    group_add:
      - ${AUDIO_GRP}

If you're running this on a raspberry-pi, you can replace ${AUDIO_GRP} with 29 as that is the id of the audiogroup user. If not, simply type id in the terminal and enter whatever number shows next to (audio).

How to run the pulseaudio variant

version: "3.5"
services:
  spotify:
    container_name: spotify
    restart: always
    image: hvalev/spotifyd-pulseaudio
    user: ${PUID}:${PGID}
    #network_mode: host #disabling to only show logged in user in spotify app (if you run multiple containers at once with different user logins)
    devices:
      - /dev/snd:/dev/snd
    group_add:
      - ${AUDIO_GRP}
    environment: 
      - PULSE_SERVER=unix:/tmp/pulseaudio.socket
      - PULSE_COOKIE=/tmp/pulseaudio.cookie
    volumes:
      - /run/user/1000/pulse/native:/tmp/pulseaudio.socket
      - ${USERDIR}/docker/spotifyd/spotifyd.conf:/etc/spotifyd.conf

How to build it

Grab the dockerfile with the configuration you wish to build and remove --platform=$BUILDPLATFORM from the first image.

Information

At the moment the rust-fix intermediary build image exists as a workaround to this bug.

Limitations

Spotifyd requires a Spotify Premium account.

Acknowledgements

Naturally, all credit goes to spotifyd. The instructions, dockerfile and explanation at GnaphronG/docker-spotifyd constitute a major portion of the contents in this repository.

About

Spotifyd within a docker container for ARM (armv7/arm64) and x32/x64 architectures in configuration variants alsa/pulseaudio for audio-backend and with/without D-Bus API for controlling spotifyd through generic media players.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published