Jellyfin Forum
Transfering Playlists between Docker Containers - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: General Questions (https://forum.jellyfin.org/f-general-questions)
+--- Thread: Transfering Playlists between Docker Containers (/t-transfering-playlists-between-docker-containers)



Transfering Playlists between Docker Containers - GarrickWinter - 2023-12-12

Hey folks,

So I'm in the process of updating my Jellyfin server from 10.7.6 to 10.8.13. I've currently got a Docker container on my Synology NAS drive that's running my old 10.7.6 version (let's call it Container 1), and a second new Container 2 that's running 10.8.13.

Container 2 works perfectly fine - I can log in and browse all my media and play things, so far so good. I also still have full access to Container 1 and all its playlists and other information. The only thing I'm missing now is how to transfer my playlists from Container 1 to Container 2 (I don't really care about any other data, like play counts or what I've watched or whatnot). I vaguely know playlists are stored as JSON files, but I can't figure out where those live in Container 1 or how to access those locations on the NAS through the Synology interface.

Does anyone know how to best go about transferring these playlists between separate containers?

Thanks!


RE: Transfering Playlists between Docker Containers - TheDreadPirate - 2023-12-12

I don't have a docker install, but I'm going to speculate it is in the container path /config/data/playlists or /config/data/data/playlists. Something like that.


RE: Transfering Playlists between Docker Containers - Efficient_Good_5784 - 2023-12-12

When you made your first container for Jellyfin (container 1), did you make an external folder location for your Jellyfin config files? Why not just point container 2 to that folder?

That is what I do for all updates to Jellyfin. Though I actually make a copy of the config folder just in case I want to revert back to the previous Jellyfin version. So my new docker container gets access only to the new copy of the config folder.

I don't exactly know what files are responsible for the playlists, but you can transfer all your data from the old container by just directly copying the whole config folder and giving it to the new container.
I'm assuming that you didn't make a host path for your config folder back then and all your config data is in the old container. You'll have to gain access to the container contents and copy them outside the container into a synology dataset/folder.
Then when you have the old config folder in a proper location, you just add it as a host path with "/config" for the new container, and all your playlists and everything else is carried over. You don't even have to rescan all of your files too.


RE: Transfering Playlists between Docker Containers - GarrickWinter - 2023-12-12

(2023-12-12, 05:21 PM)Efficient_Good_5784 Wrote: I'm assuming that you didn't make a host path for your config folder back then and all your config data is in the old container. You'll have to gain access to the container contents and copy them outside the container into a synology dataset/folder.

I think you're right, this must be what happened. When I look at the details of the old container, PATH is set to
Code:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
And there are several other directories defined below that, including JELLYFIN_CONFIG_DIR at config/config. I've been looking around File Station for these folders and not finding these config directories, but I didn't realize containers had storage and directories that were separate from the Synology device's larger file structure.

Your suggestion to move the files out of the container into the main folder structure sounds like a good one; now I just need to figure out how to get at the files in the container and copy them into the main storage.


RE: Transfering Playlists between Docker Containers - Efficient_Good_5784 - 2023-12-12

Yeah, I just confirmed what TheDreadPirate posted. All playlist files are stored in /config/data/playlists. In this location, you will have multiple folders (depending on your playlist amount) each with .xml files.

If you just want your playlist metadata, just copy all those folder and paste them into the new container in the same location. Then rescan your whole library. Then when the scan is done, your playlists will reappear in the new container.

As for what I suggested about making your config folder external as a host path, this link might help you: https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/How-to-copy-files-from-a-Docker-container-to-a-host-machine
You just need to access your synology's shell with SSH (you can enable SSH in synology's control panel), then follow the directions from the link above.

There is another way though:
  1. Stop your old container
  2. Add a new host path to old container
  3. Run old container
  4. In Synology's docker GUI, open the old container and look for how to open a terminal with it
  5. In the terminal GUI, create a new terimal (will open a bash terminal)
  6. Use the "cp" command to copy the config folder into the host path folder (-r flag for recursive)
  7. Go to your host path folder and copy it to any other external folder you want now

For number 6, your command would look like this: cp -r config pathToNewHostPathFolder/

Finally, since we're on this topic, I would recommend in the future that you make your config and cache folders external as host paths. Most likely, your Synology NAS is running all HDDs, but in the future if you ever switch to a server that has both HDDs and SSDs, you can mount both your config and cache folders on the faster SSDs to make your Jellyfin server process things faster. Also, it's not really important to copy your cache folder, you can always link to a blank cache folder as the cache will be rebuilt as you use your server.


RE: Transfering Playlists between Docker Containers - GarrickWinter - 2023-12-14

Thank you so much for your guidance on this! I've got it working nicely now. I'm just going to reiterate what I did with more verbosity, in case anyone else is having similar questions in the future and isn't quite following or gets lost.

First, I externalized the config folder from the old container by doing what Efficient_Good_5784 suggested:

  1. Create a new folder through Disk Station for the config files; let's call it HostConfig
  2. In Docker, stop the old container
  3. Rename the old container to something else (jellyfin-old for example)
  4. Right-click on jellyfin-old, select Edit, go to the Volume tab, and choose Add Folder
  5. Select HostConfig, and name the mount path something distinct (I used "config2")
  6. Run jellyfin-old
  7. In Docker, double-click on jellyfin-old, and select the Terminal tab (fourth from the left after Overview, Process, Log)
  8. Under Terminal, click Create (the newly created terminal is called "bash")
  9. Run the command "cp -r config config2/" (without quotation marks)
  10. Check the new folder to make sure it's been filled with a bunch of data

Once that's done, you have the config files living in the host volume, which is the one you can navigate with Disk Station. From there, if you haven't already done so, you need to set up your new container. In my case I was updating Jellyfin to a new version, so I did this by:

  1. In Docker, open the Registry panel
  2. Search for jellyfin (it's called jellyfin/jellyfin in the results, should be at the top)
  3. Double-click on it to download it
  4. Stop jellyfin-old
  5. Once the download is complete, go Docker's Image panel and double-click on jellyfin/jellyfin to create a new container
  6. When configuring your volume mount paths (in my case, the paths specifying where music, shows, and movies lived), also add a path to HostConfig, and use the mount path "/config"
  7. Start the new container

At this point I think you're done? I did this a few days ago and got distracted before starting the new container, and I don't have a perfect memory so it's possible I forgot a step, but I turned it on this morning and it has clearly read the config files, since all my playlists and other data is reflected in the updated version of the server.

Thanks again!


RE: Transfering Playlists between Docker Containers - Efficient_Good_5784 - 2023-12-14

(2023-12-14, 09:47 PM)GarrickWinter Wrote: At this point I think you're done?
Yeah, that's all you have to do to transfer your server information.
With Docker, as long as you keep your config and media files in an external folder location, updates to Jellyfin just require you to remount the folders to the new container.
If the new Jellyfin version requires a rework to the config file structure, it will apply those to your config folder location.

Therefore, it's helpful to make a copy of the config folder before running it with the new Jellyfin server version in case you want to revert back a server version.
Personally, I have a central folder location where I make a new subfolder each server version that comes out. I copy and paste the latest of my config folder into this new subfolder and link that to the new container in Docker.
Just make sure to turn off the container/server as you're copying the config folder to avoid copying a file as it's being written to by the server.

Also, if you want to see what the "cp" command is doing in the terminal in real-time, add the -v flag (for verbose).
So "cp -rv folder1/ folder2/" will print on the screen exactly what it's copying from folder1 to folder2 in real-time.
Same thing for the "mv" (move) command. Adding a -v flag will show that it's doing a "cp" (copy) to the new folder, followed by a "rm" (remove) on the old location to delete it there.


RE: Transfering Playlists between Docker Containers - MichaelBlack001 - 2024-01-10

There's also musconvtool to transfer playlists and liked songs across different platforms.