22
How hard is it to move Docker containers to another system?
(lemmy.dbzer0.com)
A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.
Beginning of January 1st 2024 this rule WILL be enforced. Posts that are not tagged will be warned and if not fixed within 24h then removed!
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.
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.
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