I know a lot of people (myself included) are interested in running LMS (Lyrion Music Server, aka. Logitech Media Server) on an OpenWrt router. Here I want to share how I did it and pitfalls I encountered in the process but first some background story.
Running LMS in a docker container wasn't my preferred method because the concern of extra hardware demands (amount of memory, disk space and CPU speed for the Docker Engine). My preferred method was to compile LMS under OpenWrt and run it directly under OpenWrt Linux but after some detailed investigation I realized that I don't have enough depth in Linux for this route. Also there is the question if it can really be done at all.
Now back to the topic. The router I used is a Linksys MR6350 which has 256MB of memory and 256MB of flash NAND which provides 64MB of root filesystem (disk space) for additional software packages. So the first thing to do is to add a USB storage drive and set up "extroot" environment. Follow the scripts in the Extroot configuration guide to accomplish this. But notice that the script (step. 2 Partitioning and Formatting) partitions the USB drive into a single partition. If that is what you want, it is fine. In my case I wanted three partitions - one for the root filesystem, one for storing my music files and one swap partition. So I partitioned and formatted my USB drive in my laptop with Debian 12 and skipped "step 2" of the guide. Important: if you skip "step 2", you need to define an environment variable "DEVICE=/dev/sda1" before the following steps. Make sure you do a reboot of the router after you finish all the extroot configuration steps for changes to take effective.
After reboot, I created a directory "/lms" in the root filesystem as the mount point for my music partion (/dev/sda2). I think it was done in LuCI->Mount tab. In stead of using the partition's UUID, I mounted it as a device "/dev/sda2".
For the swap partition I ran "mkswap -L swap /dev/sda3" and followed by "swapon /dev/sda3" in CLI. I ran the command "free -h" to make sure that the swap area actually existed before went back to LuCI->Nount tab to mount the swap partition. I then did another reboot and checked what I had done until now seemed to be there.
Now it was the time to setup OpenWrt as Docker container host. Basically here I installed the three packages (luci-app-dockerman dockerd docker) needed. The directories /opt and /opt/docker was created automatically after the packages were installed (probably by dockerd).
I then did what the OpenWrt Docker guide suggested, pulled the latest LMS image in CLI (docker pull lmscommunity/lyrionmusicserver). The LMS container webpage has a script to created the LMS container from the downloaded LMS image but some customization was needed. Here was my version of the script:
docker run --network=host -d \
-v "/lms/config":"/config":rw \
-v "/lms/music":"/music":ro \
-v "/lms/playlist":"/playlist":rw \
-e TZ="America/Los Angeles" \
lmscommunity/lyrionmusicserver
I ran my container creation script after I had the corresponding subdirectories on my music partition first: /config, /music and /playlist. (I actually created /music and /playlist way back when the USB drive was still on the laptop for partitioning and formatting. I also had my music files copied then.) I wasn't sure where should be a good place for "/config" so the choice of it on my music partition (/dev/sda2) was arbitrarily. The LMS should run automatically after the container was created. Please pay attention to the container name in the script and the image name. When I downloaded the LMS image the "copy" button gave me "lmscommunity/lyrionmusicserver" but the container script on the same page had "lmscommunity/logimediaserver". So when I ran the container script, I was baffled why the script was downloading an image that supposedly I had downloaded just before. It turned out the pull command downloaded version 9.0 image (lmscommunity/lyrionmusicserver) but the container creation script was looking for version 8.5.2 image (lmscommunity/logitechmediaserver). So I ended up with two images and a wrong version of LMS container (8.5.2). The current lmscommunity web page had this mismatch corrected now. (The LMS 9.0 was released on Nov.28 but the web page didn't revised until a few says later and I was doing this in between.)
A comment on the network driver for the Dock Engine. I am running the LMS on a Dump AP and I have to use the "home" network driver (--network=home) in the container creation script to make the LSM works.
Running the LMS in a docker container incurs a ton of overhead. For one thing it consumes 3.6GB of the root filesystem (with two docker images and one docker container). Also at one point of time it used like 70MB of the swap area and it seems to be growing:). MR6350 apparently is not the right router for the LMS but I will keep it running and see how it fairs in the long run. I hope my new experience with the Docker helps someone who has the adequate OpenWrt hardware and wants to run the LMS on it.