I had a Debian server running Docker and Portainer. The OS got compromised, but I did have a disk backup.
I took the opportunity to switch the system over to Proxmox, now I’m trying to restore all my Docker containers to the fresh install of a TurnKey Linux CT with Docker and Portainer installed.
I’ve extracted the /var/lib/docker folder, but I’m running into issues transferring it from Windows to the server. What data in that folder do I need to transfer, and what can I discard?
If you archived the whole docker data root then you need to copy everything to the new server and hope it will work when you extract the archive. It depends on how you archived it. You can’t extract just a part of it.
/var/lib/docker which is usually the Docker data root contains many files and symbolic links. If you don’t copy everything, meybe you will have the images, but not the references to the images so you will not be able to use any of them. Or maybe you will have the references and the images, but not the containers. You can also break Docker networks or the volumes. Everything in the dta root is there for a reason. You should never change it manually.
Yes, as I wrote above. That folder was on a Linux filesystem, you should use a Linux to extract it.
Clearly I am missing something. You had a Debian server, which is Linux. You want to move the data to an other Linux, but you can’t mount the image that you created with dd, but you could somehow open it on Windows. How did you do that? Do you remember the DD command that you used to backup the data?
Can you share those methods? When it comes to dd, I always need to do some research because I never remember how I should use it, but we may recognize a mistake in a command if we see it.
The dd archive was created by OMV and it’s built-in backup tool.
In Windows I’m able to open the dd archive with 7zip. I’m not sure but bad-superblock seems to be a data corruption issue, or when the archive isn’t created properly. I do know that the backup wasn’t a “full” disk image, so maybe that’s why I can’t mount it.
I don’t recall the commands I used, but I also tried your listed command and unfortunately wasn’t successful.
I did manage to get the archive extracted but all the symlinks are missing. When I browse the archive in Windows it shows the symlinks as shortcuts.
When I go to load the container, it tries to reference one of the symlinks in overlay2 and fails. Is there a way to recreate or refresh the overlay2 folder structure?
There is not. Though, you could throw away all damaged containers if you used volumes for each container. The only valuable data is stored in the volumes. The docker engine can be installed, the container can be recreated.
Normally, people would just backup the content of volumes (while the containers are stopped). During recovery they would install docker-ce from scratch, and
EITHER create the containers from a compose file, stop the container, restore the backup into the volumes, then start the containers again
OR create all volumes manually and restore the data into them before creating the containers from a compose file.
Oh interesting. I believe I did use volumes for all the containers. I was running OMV on bare-metal with the storage attached locally, and mapped the /config, /data, etc volumes to paths outside of the container. Is that what you mean?
Oh boy, I already wrote the answer, and overwrote it with content supposed for a different topic. Then I deleted the post, because I thought it was misplaced…
You are on the right path now! Just make sure you update the compose file to point to the new host paths where you restore the data into. Then restore all containers belonging to a compose file, until you restored all containers from all compose files.
With this approach, the worst thing that can happen is that you might need to fix ownership of the restored data (=align it with the UID/GID used by the containerized process).