Beginner's Docker Guide on Synology
Note
In case you have any difficulties following this guide or have found some errors, please leave a note on the forums. Thanks!
If you have a Synology NAS which can run Docker containers, you are in luck! Look here to check if your Synology NAS is able to run Docker containers.
This guide uses our "official" Docker image. Source and the dockerfile of the image can be found here.
Assumptions
In this guide the following assumptions apply:
- If you already have the Synology LMS packaged installed, uninstall it first. This will free up the LMS network ports so the container can use them.
- This docker container runs as your user. Note, you can also create a specific user for running the container, in that case replace the UID/PUID with the correct identifier.
- Your music is stored in the shared folder
music
. - (Optional) you have a shared folder called playlist where LMS can store playlists.
- Your user has read-only or read-write access to the music folder. If you also have a playlist folder, your user needs read-write access to this folder.
- The state of the docker image is saved in the folder
/docker/lyrionmusicserver
. The path can be anything, but it is advisable to restrict write access for other users to this folder.
Preparation (if migrating from previous LMS package)
- Do not forget to copy your favorites. You would find the file stored under
/volume1/@appstore/SqueezeCenter/prefs/favorites.opml
. Synology doesn't allow access to root directories using a normal browser. Use WinSCP instead to copy the file to a save place on your computer. - Update your Synology Diskstation to the latest DSM. Note that in order to run "Container Manager" you need DMS 7.x.
Find out the UID and GID of your user
The UID and GID values for the default user on Synlogy NAS are usually 1026 and 100. There is a very simple way to check the values as follows:
- Create a new Scheduled task as an User-defined script
- Name the script whatever you see fit
- Set it to be not repeating
- Set it to send run details to your email
-
Write the script:
id
-
Run it and soon enough, you will receive an email containing the UID and GID values.
Download the Docker image
- In the Synology GUI start up the app Container Manager.
- Go to Register.
- Search for
lyrionmusicserver
and download thelmscommunity/lyrionmusicserver
image. - Select the
latest
tag. The image will now download.
Configure the Docker container
Now the correct image has been downloaded, it is time to start and configure the container.
- In the "Container Manager" app, go to "Image", select the
lmscommunity/lyrionmusicserver
image and press "Run". - Choose a suitable name, e.g.
lyrionmusicserver
, and press "Next". -
In the "Port Settings" section, add the following ports :
Local port Container port Protocol 9000 9000 tcp 9090 9090 tcp 3483 3483 tcp 3483 3483 udp -
In the "Volume Settings" section, add the following volumes:
Local folder Container folder Mode /docker/lyrionmusicserver /config rw /music /music ro /playlist /playlist rw -
Add the UID and GID from the step above, and the appropriate TZ (timezone) to the "Enviroment" section:
Variable Value PUID for example 1026
(see the UID/GID step above)PGID for example 100
(see the UID/GID step above)TZ for example Europe/Zurich
EXTRA_ARGS "--advertiseaddr=192.168.0.100"
(your Synology's IP address)Note
Please note that the
EXTRA_ARGS
entry is only required if you use the defaultbridge
networking mode. If you decide to expose all of the container's services to the local network using thehost
mode, then defining theadvertiseaddr
is not required. -
Select "Next" and "Done". The container will automatically start.
Configure LMS
- Launch your web browser (eg. Edge, Firefox) and type:
http://[hostname or ip address of your nas]:9000
. Then, press Enter. The Lyrion Music Server web interface will open. - Choose the recommended plugins you want to install, click "Next".
- Browse to your music folder location (
/music
), highlight the directory, and click "Next". - (Optional) browse to your playlists folder location (
/playlist
), highlight the directory, and click "Next". - You'll see the Summary page for your Lyrion Music Server install. Click "Finish" to complete the installation.
- Use WinSCP to replace the
favorites.opml
in the newly created data folder with the oldfavorites.opml
you saved at the start of your move. Congrats, you're done!
Updating the Docker image
It is always advisable to regularly update your software, and with Docker on Synology it is made very easy.
- In the "Container Manager" app, go to "Image", and check if the
lmscommunity/lyrionmusicserver
image has any updates available. - If there are updates, click "Update available" and press "Update" twice.
- Now the image is updated, refreshed and automatically restarted. If you followed the guide above all important data is saved and stored in Docker volumes, so this update will not overwrite anything in your configuration.
- Done, and enjoy all new features and fixes!
Note
If you use a tag other than latest
then Synology does not automatically check for updates. To update
go to "Container" and stop the LMS container. Then go to "Registry", search the lmscommunity/lyrionmusicserver
image and select the tag you are using. Once the updated image had been downloaded, go to "Container",
select the LMS container and press "Reset". You get a warning that all data in the container will be lost,
but that does not matter since all your configuration is in Docker volumes so you can press "Yes"! When
that's done you can start the container again.
Migrating from lmscommunity/logitechmediaserver
to lmscommunity/lyrionmusicserver
With the release of LMS9 the image lmscommunity/logitechmediaserver
is deprecated and the image lmscommunity/lyrionmusicserver
is used from now on. To migrate to the new image while retaining all settings, all you need to do is the following:
- In the "Container Manager" app, go to "Container" and click on your current LMS container. Then press "Action" and choose "Export". Choose "Export container settings" and "Export to local computer". Click on "Export".
- You now have downloaded a json file which contains all the configuration of your LMS container. Use your favorite text editor and open the json file.
-
Now find the following line in the json file:
"image" : "lmscommunity/logitechmediaserver:stable",
It could be that you used another tag, such as
dev
, in that case the line looks like this:"image" : "lmscommunity/logitechmediaserver:dev",
Change this line to:
"image" : "lmscommunity/lyrionmusicserver:stable",
It is recommended to use the
stable
tag, more information about which tag is most suitable for you is described here. Please also make sure that all the quotation marks and the trailing comma stays intact. -
Next step is to download the new image. Go to "Registry" and download the
lmscommunity/lyrionmusicserver
image. Choose the same tag you have specified in the json file. - Before we recreate the container using the updated configuration we need to remove the current container (nothing important will be removed, as the data is stored in volumes and the container configuration is saved in the json file). Select the LMS container, choose "Action" > "Stop", and subsequently "Delete".
- Last step is to recreate the container using the freshly downloaded image and the edited json file. First, go to the "Container" screen. If you do not have any containers running, press the "Import" button, else click "Action" and press "Import" > "From local device". In the "Import Container" screen, browse to the just edited file and enter a suitable "Container name" (for instance
lyrionmusicserver
). Press "Import". - Start the new container and you are all set!