How should I go about migrating docker containers to an other server reddit / selfhosted ---------------------------------------------------------------------- lucassou · 2023-10-05 14:37 Hey, So I've been hosting services for a while on a raspberry pi 4, it worked alright but I wanted something a little bit more responsive for some services so i've purchased a second hand intel nuc. I run almost everything in docker containers and manage everything using portainer. Most of the services uses volumes for persistent data, some uses static files, but quite a few have databases which are the ones worrying me (sqlite, mariaDB, postgre, mongodb...) Currently my strategy to migrate everything to a new sever is essentially shuttingdown everything on the raspberry, copy all the volumes to the new server, export and import the portainer config on the new server, adapt the volume path for each services, start every container again and manually fix the services that didn't like the transfer. I was wondering if there was some better way to proceed. ---------------------------------------------------------------------- Eirikr70 · 2023-10-05 14:56 It sounds perfect, but some apps might have specific policies for migrating, such as [Immich](https://immich.app/docs/administration/backup-and-restore). So you'd better control the migration before erasing any of the data off from the Pi. ---------------------------------------------------------------------- FragoulisNaval · 2023-10-05 15:18 I did exactly as you described when i purchased my backup server and everything worked smoothly. ---------------------------------------------------------------------- CrispyBegs · 2023-10-05 15:29 i did what you're describing and it worked fine ---------------------------------------------------------------------- thekrautboy · 2023-10-05 16:19 For database containers, its common practice to pin their images to specific versions (or atleast major versions) and not use *latest* for example. Also to run a proper backup of the database (dump) instead of just copying the volumes, databases can be weird about that. So depening on the exact db type, run a backup or dump of it. ---------------------------------------------------------------------- Ok-Flounder-9205 · 2023-10-05 17:38 You had to check your used container Image because of the architecture. The raspberry pi has an arm CPU and your nuc x86 or amd64. ---------------------------------------------------------------------- lucassou · 2023-10-05 17:46 Yeah thanks I know that I had to use a special tag for the version of mongodb, i'll need to update that. ---------------------------------------------------------------------- peteyhasnoshoes · 2023-10-06 01:04 This is spot on. Databases are often way bigger on disk than the dump too. It's always best to configure things using flat text files like compose if possible, when things go awry or need migrating it makes life so much easier ---------------------------------------------------------------------- sowhatidoit · 2023-10-06 02:45 I'm in a similar boat. I've been exclusively using a pi to selfhost and now designing the layout to accomodate an additional 2 machines. This doesn't really answer your question but I am considering to document my configurations using something like Ansible, for when future hardware upgrades/failures occur. I can be up and running in a short amount of time. I'm curious to hear what people suggest. ---------------------------------------------------------------------- haaiiychii · 2023-10-06 19:26 That's pretty much what I did when moving from a Pi to a NUC. Just stopped everything, SCP'd it across and everything worked straight away (luckily)