How hard is it to move Docker containers to another system? - eviltoast

Or another container type if there’s a better one?

My server was originally connected to my TV to run Kodi and play some games while serving files, so it’s running Xubuntu. While it works well for the most part, I want to set it up properly, and be able to move the services to a new system when the time comes.

I was thinking that Docker, or another container system, would probably be best, because as well as hopefully being able to be moved, installing new software shouldn’t affect anything else.

Am I on the right track? Can containers be moved to another system without needing to be set up again?

I’m running the *arr suite two Java Minecraft servers Plex media server Two copies of qBittorent NZBGet Ombi Mylar Codex and probably some others that I’ve forgotten.

While I’m at it, is there a best OS to base everything on? Preferably free. The server is a 4th generation i5 with 32GB RAM, and currently about 10TB of HDD space, with a small SSD for boot, and a Quadro graphics card for transcoding.

Thanks in advance :)

  • shastaxc@lemm.ee
    link
    fedilink
    arrow-up
    4
    ·
    1 year ago

    The data that your software interacts with is external to a container but can be mapped to the container file system so that the software can interact with it. For example, your Minecraft server relies on disk files consisting of the world state and server config files (and plugins if you have any). These will still be on your host system, not inside the container. In order to transfer this to another system, you have to take those files from your host and move them to the new host. Then copy your docker config files over too so you can start a new container that points to your files on disk and it should function the same as it did before, but possibly with a different IP address.

    An easy way to think of it is that a container can be restarted, like maybe when you restart the PC. When a container is restarted, all the files in the container reset to their initial state. If you go into a container and create files then restart the container, those files will be gone. Any data that needs to be persisted between restarts needs to go on your host filesystem and volume mount it to the container.

    • Tippon@lemmy.dbzer0.comOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Thanks for replying :)

      I think I’m starting to understand it a bit better. Your first paragraph explains what I thought a Docker container would be like, except that I wasn’t sure whether the Minecraft server would be part of the container or not. I always thought of containers as like a mini OS that just runs the required software, and connects to data outside of the container. This is why I thought they could be moved, like a virtual machine can be moved.

      Would I be right in thinking that as long as the config is saved externally, the container can be rebuilt on any system with that config file? If so, that’s probably exactly what I need.

      My data is currently on separate drives to the OS, so my plan is to replace the installed software, e.g. Radarr, with a containerised version so that everything is in containers where possible, then replace the OS with something more suitable. When the computer eventually gets replaced, I want to be able to start up the containers and be ready to go without having to set up all the software again.

      • shastaxc@lemm.ee
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        Yes that’s correct. And containers are not really portable in the way you described. They do have a mini OS in them but the state is not saved when they are “offline”. So you can think of it as more of a template, called an image. You can save the image to a file, and move that to a new pc and load that back into Docker, but that’s usually unnecessary. As long as you have Internet, you just need to know the name of the image and Docker will just download it if it doesn’t already have it. For most popular programs, you’ll find an image for it already created so just follow the instructions on what settings to use for things like volume mounts and environment variables. This configuration of variables can be saved into a Docker Compose file for easy reuse instead of typing really long command line to run your container. This Compose file is all you really need to move to the other PC and it’ll just download your image and run everything as before.

        • Tippon@lemmy.dbzer0.comOP
          link
          fedilink
          English
          arrow-up
          2
          ·
          1 year ago

          Oh, that’s even easier than I thought then :)

          I’ve got a great internet connection, so as long as I save the Compose files, I can rebuild the image forever, barring changes to the program in the container then. Much easier :D