I use the product Portainer to manage the various docker containers I have at home. Periodically, I change my infrastructure set up, which results in my having to transfer the Portainer containers to a different server.
This time, I have decided to document what I did, in an attempt to not have to recreate the wheel next time I need to perform this activity.
- Check you have the command line for starting Portainer.
- Obviously, you will need this to start up portainer when it gets where it is going.
- Make a volume on the new host.
- This will hold a copy of the persisted Portainer data.
- Stop portainer on the old host
- Backup the old volume on the old host.
- You’ll likely need to be root to view the folder correctly.
- Transfer the backed up file to the new host using scp.
- Restore the backup file into the volume on the new host.
- You’ll likely need to be root to get the permissions correct.
- Startup portainer using the volume
- At this point the transfer of Portainer is technically complete.
- Test you can connect to portainer.
- Startup portainer agent on the old host.
- This is so that I have access to the old host again.
I’m going to need this to clean up the old host.
- This is so that I have access to the old host again.
- Redirect the proxy.
- I use NPM and I needed to fix the proxy to fetch portainer from the new host.
- Clean up stacks
- In this situation i am moving to a new Lab server, so I have copied stacks from the old host to the new host, manually backing up and transferring volumes as required.
