Search code examples
dockerbackup

How to backup docker container with data and move to another server?


I'm definitely new to docker at all, started to use it a while ago and I need to move my stuff from one server to another. I thought that just creating a personal image will solve this issue, but nope :D.

So if I'm right, all data is saved on created volume, right? Like one of the containers is PostgreSQL.

So to move everything i need also backup the volume and export it on a new server?

https://docs.docker.com/storage/volumes/#backup-restore-or-migrate-data-volumes

This is what I found on their docs.

Hope somebody could help me with understanding


Solution

  • Docker, for default, stored images, containers, volumes, and other data, into /var/lib/docker, if not customized by the file /etc/docker/daemons.json as explained here.

    In order to move all the graph to a new server you should:

    • Stop docker service.
    • Copy data root.
    • Restart docker service.

    Regards.