├── .gitignore ├── TODO.md ├── .dockerignore ├── startup.sh ├── docker-compose.yml ├── Makefile ├── LICENSE ├── lms-setup.sh ├── Dockerfile └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | lmsdeb.txt 2 | 3 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | - Make LOCALE runtime configurable in lms-setup.sh 2 | - Add log rotating 3 | 4 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | README.md 3 | TODO.md 4 | LICENSE 5 | Makefile 6 | docker-compose.yml 7 | 8 | 9 | -------------------------------------------------------------------------------- /startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | /lms-setup.sh 3 | 4 | # port forward to an external MusicIP host on standard MusicIP port 5 | [ -n "$MUSICIP_HOST" ] && socat TCP-LISTEN:10002,fork TCP:$MUSICIP_HOST:10002 & 6 | 7 | # run server directly as lms user to avoid permissions bug on fresh startup 8 | exec su lms -c "/usr/sbin/squeezeboxserver --prefsdir /mnt/state/prefs --logdir /mnt/state/logs --cachedir /mnt/state/cache --charset=utf8" 9 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | logitechmediaserver: 2 | container_name: "logitechmediaserver" 3 | image: justifiably/logitechmediaserver 4 | restart: unless-stopped 5 | environment: 6 | - MUSICIP_HOST=musicip # If you run MUSICIP on another machine/container 7 | labels: 8 | - "autoheal=true" # See https://github.com/willfarrell/docker-autoheal 9 | - "autoheal.stop.timeout=20" 10 | ports: 11 | - 9000:9000 12 | - 9005:9005 13 | - 9010:9010 14 | - 9090:9090 15 | - 3483:3483 16 | - 3483:3483/udp 17 | - 5353:5353/udp # mDNS, watch for clash with avahi daemon on host 18 | volumes: 19 | - /srv/music/music:/mnt/music:ro 20 | - /srv/music/lms-playlists:/mnt/playlists 21 | - /srv/lms-state:/mnt/state 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | SH=/bin/bash 2 | TAG=$(shell cat lmsdeb.txt | sed 's/.*_\([0-9\.~]*\)_all.deb/\1/' | sed 's/~/-/') 3 | USER=justifiably 4 | LMS_PATCHES=Y 5 | 6 | build: 7 | docker build --build-arg LMSDEB=`cat lmsdeb.txt` --build-arg LMS_PATCHES=$(LMS_PATCHES) -t $(USER)/logitechmediaserver:$(TAG) .; docker tag $(USER)/logitechmediaserver:$(TAG) $(USER)/logitechmediaserver:latest 8 | 9 | base: 10 | wget -O - -q "http://www.mysqueezebox.com/update/?version=8.1.1&revision=1&geturl=1&os=deb" > lmsdeb.txt 11 | 12 | # Grab 8.1.2 development release 13 | update: 14 | -(LMSLATEST=`wget -O - -q "http://www.mysqueezebox.com/update/?version=8.1.2&revision=1&geturl=1&os=deb"`; if [ "`cat lmsdeb.txt`" = "$$LMSLATEST" ]; then echo "No update available"; exit 1; else /bin/echo -n $$LMSLATEST > lmsdeb.txt; fi) 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 JingleManSweep, 2017-20 Justifiably 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 | -------------------------------------------------------------------------------- /lms-setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # First startup: use a fixed UID/GID to share externally and move config dir to allow editing convert.conf. 4 | if ! id -u lms >/dev/null 2>&1 ; then 5 | groupadd --gid $PGID lms 6 | useradd --system --uid $PUID --gid $PGID -M -d /usr/share/squeezeboxserver -c "Logitech Media Server user" lms 7 | mv /etc/squeezeboxserver /etc/squeezeboxserver.orig 8 | ln -s /mnt/state/etc /etc/squeezeboxserver 9 | fi 10 | 11 | # Automatically update to newer version if exists 12 | if [ -f /mnt/state/cache/updates/server.version ]; then 13 | cd /mnt/state/cache/updates 14 | UPDATE=`cat server.version` 15 | dpkg -i $UPDATE 16 | mv server.version this-server.version 17 | # Keep a history for rollback in case of problems; 18 | # to prune this add: rm -f $UPDATE. 19 | 20 | # Apply patches if wanted 21 | if [ -n "$LMS_PATCHES" ]; then cd /usr/share/perl5; for f in /*.patch; do patch -p1 < "$f"; done; fi 22 | 23 | # Update the new config defaults (but leave user dir alone) 24 | rm -rf /etc/squeezeboxserver.orig 25 | mv /etc/squeezeboxserver /etc/squeezeboxserver.orig 26 | ln -s /mnt/state/etc /etc/squeezeboxserver 27 | fi 28 | 29 | # recreate startup config and cache dirs in case lost 30 | mkdir -p /mnt/state/prefs /mnt/state/logs /mnt/state/cache 31 | if [ ! -d /mnt/state/etc ]; then 32 | mkdir -p /mnt/state/etc 33 | cp -pr /etc/squeezeboxserver.orig/* /mnt/state/etc 34 | fi 35 | 36 | # State directory and playlists should be editable by the server 37 | chown lms.lms -R /mnt/playlists 38 | chown lms.lms -R /mnt/state 39 | chmod g+s /mnt/state /mnt/playlists 40 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM buildpack-deps:buster-curl 2 | 3 | ARG DEBIAN_FRONTEND=noninteractive 4 | 5 | # Env variables persisted in container 6 | ARG PUID=819 7 | ARG PGID=819 8 | ENV PUID $PUID 9 | ENV PGID $PGID 10 | 11 | # 8.1.1 stable release, 14th Jan 2021. 12 | ARG LMSDEB=http://downloads.slimdevices.com/LogitechMediaServer_v8.1.1/logitechmediaserver_8.1.1_all.deb 13 | 14 | RUN echo "deb http://www.deb-multimedia.org buster main non-free" | tee -a /etc/apt/sources.list && \ 15 | apt-get update -o Acquire::AllowInsecureRepositories=true && apt-get install -y --allow-unauthenticated deb-multimedia-keyring && \ 16 | apt-get install -y --allow-unauthenticated \ 17 | perl \ 18 | libcrypt-openssl-rsa-perl libio-socket-inet6-perl libwww-perl libio-socket-ssl-perl \ 19 | locales \ 20 | espeak \ 21 | faad \ 22 | faac \ 23 | flac \ 24 | lame \ 25 | sox \ 26 | ffmpeg \ 27 | wavpack \ 28 | socat \ 29 | --no-install-recommends && \ 30 | apt-get upgrade -y --allow-unauthenticated && \ 31 | apt-get clean && \ 32 | rm -rf /var/lib/apt/lists/* 33 | 34 | RUN curl -o /tmp/lms.deb $LMSDEB && \ 35 | dpkg -i /tmp/lms.deb && \ 36 | rm -f /tmp/lms.deb 37 | 38 | RUN mkdir /mnt/state /mnt/music /mnt/playlists 39 | 40 | ARG LOCALE=en_GB.UTF-8 41 | ENV LANG=$LOCALE 42 | RUN echo "$LOCALE UTF-8" > /etc/locale.gen && \ 43 | DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales && \ 44 | echo LANG=\"$LOCALE\" > /etc/default/locale 45 | 46 | COPY lms-setup.sh startup.sh / 47 | 48 | VOLUME ["/mnt/state","/mnt/music","/mnt/playlists"] 49 | 50 | EXPOSE 3483 3483/udp 9000 9005 9010 9090 5353 5353/udp 51 | 52 | HEALTHCHECK --interval=3m --timeout=30s \ 53 | CMD curl --fail http://localhost:9000/Default/settings/index.html || exit 1 54 | 55 | CMD ["/startup.sh"] 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Docker Container for Logitech Media Server 2 | 3 | > **Please note:** there is now an official 4 | > [LMS community supported Docker image here](https://hub.docker.com/r/lmscommunity/logitechmediaserver). I encourage you to switch to using that one. 5 | 6 | Docker image for 7 | [Logitech Media Server](https://github.com/Logitech/slimserver) (aka 8 | SqueezeCenter, SqueezeboxServer, SlimServer). 9 | 10 | Runs as non-root user, installs useful dependencies, sets a locale, 11 | exposes ports needed for various plugins and server discovery and 12 | allows editing of config files like `convert.conf`. 13 | 14 | Newer versions of Logitech Media Server support updates in place. To 15 | recreate this container I keep a tag of the latest version build in the 16 | working directory. To update that: 17 | 18 | make update 19 | 20 | To build the image: 21 | 22 | make build 23 | 24 | See Github network for other authors (JingleManSweep, map7, joev000). 25 | 26 | Works well with my [MusicIP container](https://hub.docker.com/r/justifiably/musicip/). 27 | See below if you run MusicIP on another host or want to avoid running with net=host. 28 | 29 | 30 | ### Running the server 31 | 32 | You need a hardware or software player to connect to the server, see 33 | pointers below. 34 | 35 | Minimal run example: 36 | 37 | docker run --net=host -v :/mnt/music justifiably/logitechmediaserver 38 | 39 | Then: 40 | 41 | * Visit the server and configure it from 42 | * Skip the `mysqueezebox.com` configuration if you want a local-only solution 43 | * Select `/mnt/music` and `/mnt/playlists` as your music and playlist folders 44 | * If you mainly use streaming services, several are available in the Plugins tab 45 | * Recommended: the modern [Material skin][lms-material], activate the plugin and select it on Interface tab 46 | * for arcane server settings, you may still need to access [the default skin](http://localhost:9000) 47 | 48 | Here is a more complex run example, putting the process in background, mapping the server 49 | and player ports only and mounting volumes for music and state: 50 | 51 | docker run -d -p 9000:9000 -p 3483:3483 -p 3483:3483/udp -v :/mnt/state -v :/mnt/playlists -v :/mnt/music justifiably/logitechmediaserver 52 | 53 | The music volume mount allows you to map an external directory already 54 | loaded with music. The state volume mount allows you to persist the 55 | state between different server containers. This is useful if you want 56 | to play with plugins, or edit `convert.conf` to tweak transcoding 57 | settings. 58 | 59 | 60 | ### Using Docker Compose 61 | 62 | See the sample `docker-compose.yml`. Edit the volume settings 63 | appropriately, run as usual by: 64 | 65 | docker-compose up -d 66 | 67 | 68 | ### Port forwarding for MusicIP 69 | 70 | I've added an install of socat (careful) so that MusicIP can be run on another 71 | machine. Logitech Media Server assumes MusicIP is running on the same host so 72 | this seems the best solution (replacing previous attempt to patch the code). 73 | Set the environment variable to to port-forward to a named host or IP: 74 | 75 | MUSICIP_HOST=musicip.mynetwork 76 | 77 | (of course the instance of MusicIP needs to return paths that make sense to the 78 | local server as well). 79 | 80 | 81 | ### Pointers 82 | 83 | Most help and up to date information is available on the excellent 84 | forums: 85 | 86 | * [SqueezePlay software players](http://wiki.slimdevices.com/index.php/SqueezePlay_binaries) 87 | handy for testing or laptop use. 88 | * Original sadly discontinued [Logitech hardware players](http://wiki.slimdevices.com/index.php/Main_Page#Players_.26_Controllers) 89 | * The excellent [PiCorePlayer](https://www.picoreplayer.org) distribution for Raspberry Pi 90 | * Many others... 91 | 92 | [lms-material]: https://forums.slimdevices.com/showthread.php?109624-Announce-Material-Skin 93 | --------------------------------------------------------------------------------