Best practize full backup and restore ( image + volumes + config )


i spend now some time with this topic, but did not really find a good solution.

The goal would be to simply backup all docker related information on host A and move it to host B.

Unfortunately it seems that docker ( why ever ) does not provide any solution for this.

You can export/commit/save/load/import/what ever volumes and images. Great.

But then you have an image and you have volumes. That will not bring back your docker config ( port mappings and so on ). For this you would need a docker compose ( which is not part of the backup ).

So you have the raw data and either you have the old docker compose file or you will have fun.

And what actually happens if you dont have named volumes? You have fun.

Is there really no script/software that will simply run a docker inspect, travers through all relevant data and just generate / save the required information ( image + volumes + config )?

Its nice if you have to consume your time to puzzle all together, but well, maybe its not necessary.

So is there anything out there, that will simply make a backup that you can restore it and just start your container(s) like you started them on the system where they came from?

Thank you!

The concept of container is to start them, run them, then “throw away”.

You usually would not go into a container, change things and back them up. Therefore no such tooling is even needed.

We have a docker-compose.yml that contains everything. If the container really needs to write files, we use a bind mount.

So everything is regular files, we can backup and move to different node, start new container there.

If you really need to backup your whole system, you could run them in a VM, tools like ProxMox enables easy migration of the whole VM to a new node.