How to Backup and Restore Docker Volumes

preview_player
Показать описание
Learn how to backup and restore Docker volumes. Specifically, we will backup a Postgres Database using Docker volumes

Become a Better Developer

My Software

Download Code

⌛ Timestamps
0:00 - Introduction
0:08 - Creating a Postgres Volume to Backup
1:39 - Creating a Tarball from a Docker Volume
3:33 - Creating a Volume from the Backup
4:53 - Verifying the Backup Worked
6:11 - Outro
Рекомендации по теме
Комментарии
Автор

Great video.

I have been using restic to backup Docker volumes. It is a great too that I recommend.

NjoguAmos
Автор

Merci pour les tips que tu partage. Quel est la meilleure restauration pour une base de données? Restaurer le volume ou utiliser pg_dump selon vous

DnaiLabs
Автор

Great stuff, thanks! Let's hope there will be an easier way to backup volumes in the future. This feels a bit hacky.

balazspekar
Автор

Thx for the breakdown of how to manually do all this.

Is there anything that does a better automated no-thinking backup/restore? Problem is I have 6+ docker hosts and counting, config files all over the place....each docker host has docker-compose.yml that chooses different locations for its volumes depending on how the dev chose to create their getting started docs (netmaker apparently doesn't specify a path so it auto-created it's docker volumes under /var/lib/docker/volumes/ and a bunch of different folders that are ) just as one example where I started my docker-compose.yml and .env file in /root/ because I didn't know any better at the time.
I can definitely see that getting messy fast when trying to migrate etc. Any thoughts on making this a better process is appreciated. Maybe I need to start trying to do something like Coolify

silversword
Автор

Nice Tutorial.
I have OpenProject Container at one server with data.

Now I got another server 2
I was able to backup multiple volumes from server 1 of Open Project in tar file.

But on other server, when I run command to restore then it shows no container exists.

Do I Need To host OpenProject again on server 2, then replace the volumes?

Could you pls guide? Thanks

DepuDev-ou
Автор

Great explanation but not sure why I got an error while following the same steps as yours. Can you help me?

docker run --rm -v -v busybox tar xvf /postgres-datavol2.tar

tar: invalid tar magic

chithraraman
join shbcf.ru