├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── docker-compose.yml ├── entrypoint.sh └── start-squeezebox.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:xenial 2 | MAINTAINER Lars Kellogg-Stedman 3 | 4 | ENV SQUEEZE_VOL /srv/squeezebox 5 | ENV LANG C.UTF-8 6 | ENV DEBIAN_FRONTEND noninteractive 7 | ENV PACKAGE_VERSION_URL=http://www.mysqueezebox.com/update/?version=7.9.0&revision=1&geturl=1&os=deb 8 | 9 | RUN apt-get update && \ 10 | apt-get -y install \ 11 | curl \ 12 | wget \ 13 | faad \ 14 | flac \ 15 | lame \ 16 | sox \ 17 | libio-socket-ssl-perl \ 18 | tzdata \ 19 | && \ 20 | apt-get clean 21 | 22 | RUN url=$(curl "$PACKAGE_VERSION_URL" | sed 's/_all\.deb/_amd64\.deb/') && \ 23 | curl -Lsf -o /tmp/logitechmediaserver.deb $url && \ 24 | dpkg -i /tmp/logitechmediaserver.deb && \ 25 | rm -f /tmp/logitechmediaserver.deb && \ 26 | apt-get clean 27 | 28 | # This will be created by the entrypoint script. 29 | RUN userdel squeezeboxserver 30 | 31 | VOLUME $SQUEEZE_VOL 32 | EXPOSE 3483 3483/udp 9000 9090 33 | 34 | COPY entrypoint.sh /entrypoint.sh 35 | COPY start-squeezebox.sh /start-squeezebox.sh 36 | RUN chmod 755 /entrypoint.sh /start-squeezebox.sh 37 | ENTRYPOINT ["/entrypoint.sh"] 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 JingleManSweep 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Docker Container for Logitech Media Server 2 | 3 | This is a Docker image for running the Logitech Media Server package 4 | (aka SqueezeboxServer). 5 | 6 | Run Directly: 7 | 8 | docker run -d --init \ 9 | -p 9000:9000 \ 10 | -p 9090:9090 \ 11 | -p 3483:3483 \ 12 | -p 3483:3483/udp \ 13 | -v /etc/localtime:/etc/localtime:ro \ 14 | -v :/srv/squeezebox \ 15 | -v :/srv/music \ 16 | larsks/logitech-media-server 17 | 18 | 19 | The web interface runs on port 9000. If you also want this available 20 | on port 80 (so you can use `http://yourserver/` without a port number 21 | as the URL), you can add `-p 80:9000`, but you *must* also include `-p 22 | 9000:9000` because the players expect to be able to contact the server 23 | on that port. 24 | 25 | ## Using docker-compose 26 | 27 | There is a [docker-compose.yaml][] included in this repository that 28 | you will let you bring up a Logitech Media Server container using 29 | `docker-compose`. The compose file includes the following: 30 | 31 | volumes: 32 | - ${AUDIO_DIR}:/srv/music 33 | 34 | To provide a value for `AUDIO_DIR`, create a `.env` 35 | file that points `AUDIO_DIR` at the location of your music library, 36 | for example: 37 | 38 | AUDIO_DIR=/home/USERNAME/Music 39 | 40 | [docker-compose.yaml]: docker-compose.yaml 41 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | # The "init:" keyword, below, requires either version "2.2" 2 | # or "2.3". 3 | version: "2.3" 4 | 5 | services: 6 | lms: 7 | image: larsks/logitech-media-server 8 | volumes: 9 | - /etc/localtime:/etc/localtime:ro 10 | - squeezebox:/srv/squeezebox 11 | - ${AUDIO_DIR}:/srv/music 12 | ports: 13 | ## uncomment the following line if you want to be able to 14 | ## access the web ui on port 80. 15 | # - "80:9000" 16 | - "9000:9000" 17 | - "9090:9090" 18 | - "3483:3483" 19 | - "3483:3483/udp" 20 | restart: always 21 | init: true 22 | 23 | volumes: 24 | squeezebox: 25 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | : ${SQUEEZE_UID:=1000} 4 | : ${SQUEEZE_GID:=1000} 5 | 6 | groupadd -g $SQUEEZE_GID squeezeboxserver 7 | 8 | useradd -u $SQUEEZE_UID -g $SQUEEZE_GID \ 9 | -d /usr/share/squeezeboxserver/ \ 10 | -c 'Logitech Media Server' \ 11 | squeezeboxserver 12 | 13 | if [ "$SQUEEZE_VOL" ] && [ -d "$SQUEEZE_VOL" ]; then 14 | for subdir in prefs logs cache; do 15 | mkdir -p $SQUEEZE_VOL/$subdir 16 | done 17 | fi 18 | 19 | # This has to happen every time in case our new uid/gid is different 20 | # from what was previously used in the volume. 21 | chown -R squeezeboxserver:squeezeboxserver $SQUEEZE_VOL 22 | 23 | exec runuser -u squeezeboxserver -- /start-squeezebox.sh "$@" 24 | 25 | -------------------------------------------------------------------------------- /start-squeezebox.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | myip=$( ip addr show eth0 2> /dev/null | awk '$1 == "inet" {print $2}' | cut -f1 -d/ ) 4 | 5 | if [ "$myip" ]; then 6 | url="http://$myip:9000/" 7 | 8 | echo ====================================================================== 9 | echo "$url" 10 | echo ====================================================================== 11 | echo 12 | fi 13 | 14 | exec squeezeboxserver \ 15 | --prefsdir $SQUEEZE_VOL/prefs \ 16 | --logdir $SQUEEZE_VOL/logs \ 17 | --cachedir $SQUEEZE_VOL/cache "$@" 18 | 19 | --------------------------------------------------------------------------------