# balenaOS with spotifyd service - Spotify streamer.

**URL:** <https://forums.balena.io/t/balenaos-with-spotifyd-service-spotify-streamer/373614>\
**Category:** balenaHub\
**Created:** [February 14, 2025, 7:39pm UTC](https://forums.balena.io/t/balenaos-with-spotifyd-service-spotify-streamer/373614 "2025-02-14T19:39:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![krzakx](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@krzakx](https://forums.balena.io/u/krzakx)\
**Post date:** [February 14, 2025, 7:39pm UTC](https://forums.balena.io/t/balenaos-with-spotifyd-service-spotify-streamer/373614/1 "2025-02-14T19:39:46Z")

</div>

Hello,  
After using balena sound for 4 month [GitHub - balena-io-experimental/balena-sound: Build a single or multi-room streamer for an existing audio device using a Raspberry Pi! Supports Bluetooth, Airplay and Spotify Connect](https://github.com/balena-io-experimental/balena-sound) I am force to look for alternative as it does [lags & Interrupts randomly](https://github.com/balena-io-experimental/balena-sound/issues/681#issuecomment-2656766124).  
My device is Raspberry Pi3

Becasue of above I trying to build a Release at balenaCloud with Spotifyd as container/service.  
However I do face problems, let start for begining.  
This is how my project structure does looks like:  
spotify-balena/  
├── .gitignore  
├── docker-compose.yml  
└── spotifyd/  
├── Dockerfile.template  
└── start.sh

my docker-compose.yml contains:

```auto
version: '2.4'

services:
  spotifyd:
    build: ./spotifyd # Ścieżka do katalogu z Dockerfile
    container_name: spotifyd
    restart: unless-stopped
    network_mode: host
    privileged: true
    environment:
      - SPOTIFY_USERNAME=${SPOTIFY_USERNAME}
      - SPOTIFY_PASSWORD=${SPOTIFY_PASSWORD}
      - SPOTIFY_DEVICE_NAME=RaspberryPi
      - SPOTIFY_BITRATE=160
      - SPOTIFY_BACKEND=alsa
      - SPOTIFY_DEVICE=hw:0
    labels:
      io.balena.features.dbus: '1'

```

my docker-template.file

```auto
FROM balenalib/raspberrypi3-debian:latest

# Instalacja zależności
RUN apt-get update && apt-get install -y \
    curl \
    alsa-utils \
    build-essential \
    libasound2-dev \
    libssl-dev \
    pkg-config \
    git \ # Dodaj git
    && rm -rf /var/lib/apt/lists/*

# Instalacja Rust i Cargo
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

# Pobierz i zbuduj Spotifyd z repozytorium GitHub
RUN git clone https://github.com/Spotifyd/spotifyd.git /spotifyd
WORKDIR /spotifyd
RUN cargo build --release

# Skopiuj skrypt startowy
COPY start.sh /usr/local/bin/start.sh
RUN chmod +x /usr/local/bin/start.sh

# Ustawienie punktu wejścia
ENTRYPOINT ["/usr/local/bin/start.sh"]

```

and **`start.sh`**

```auto
#!/bin/bash
/spotifyd/target/release/spotifyd \
    --username "$SPOTIFY_USERNAME" \
    --password "$SPOTIFY_PASSWORD" \
    --device-name "$SPOTIFY_DEVICE_NAME" \
    --bitrate "$SPOTIFY_BITRATE" \
    --backend "$SPOTIFY_BACKEND" \
    --device "$SPOTIFY_DEVICE"

```

it does build sucesfully however SpotifyD doesn’t start giving following errors:

```auto
 spotifyd /usr/bin/spotifyd: line 1: Not: command not found
Service exited 'spotifyd sha256:aa55e81a0c4b412e879493702edffa43a2082eec35298fb5c300a400389b431a'
Restarting service 'spotifyd sha256:aa55e81a0c4b412e879493702edffa43a2082eec35298fb5c300a400389b431a'

```

anybody can support please?
