How to Migrate Docker Containers with Data to a New VM Using Portainer?

0
35
Asked By TechWizard42 On

I'm trying to migrate a Docker container along with its data, volumes, and PostgreSQL from one VM to another that has Portainer set up. Currently, I have Immich running on a separate Docker VM where I've uploaded photos. I created a `docker-compose.yaml` file and tried to set it up in Portainer while pointing it to my external TrueNAS storage through NFS sharing/sata passthrough. Unfortunately, it looks like I'm starting fresh—the login info and users are missing, and I can't see any of my photos, even though it shows I'm using 380GB of space.

I've made several attempts: first, I copied just the `.yaml` and `.env` files, which clearly wasn't enough. On the second try, I used `scp` to transfer PostgreSQL data and other files, but still no luck. On my third attempt, I tried a `.tar.gz` file but ran into issues there too.

Is there a straightforward method to transfer everything from one VM to the new Portainer VM? Is there a chance to access my photos again, or will I need to re-upload everything? I haven't deleted any data yet, and all my original photos are still available. Thanks!

3 Answers

Answered By MigrationGuru On

Honestly, I wouldn't recommend going with Portainer for this purpose. It has a tendency to mishandle compose files, storing them in a location that's not straightforward. If you want a GUI, consider using something like Dockge that respects original compose files. This way, you might not even need a full migration. If you're just moving servers, you could simply migrate the VM as it is.

TechWizard42 -

I've heard of Dockge! I'll definitely look into it. Thanks for the tip!

Answered By DockerDude88 On

You might be missing your volumes during the migration. Make sure you're using the same `docker-compose.yml` and you run `$ docker down` on the old container before deploying it on Portainer. Just copy over the stack to the web editor in the new setup and start the container from there. It can be pretty straightforward if you’re dealing with individual apps.

Answered By CloudySkywalker On

Consider just keeping the existing VM with the additional Portainer installation instead of setting up a separate one. Running containers directly on your main VM might save you the hassle of migration. Also, try executing the Docker Compose files directly from the command line and keep a precise log this time. It’ll make troubleshooting easier in the future.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.