I was wondering if I was backing up my container's volumes correctly.
Info
System :
NAS Synology with docker App
What I use to build my containers :
Docker-compose
Process
This is how I do :
First I build my containers with docker-compose up -d
:
docker-compose.yaml
...
nginx:
image: 'jlesage/nginx-proxy-manager:latest'
container_name: Nginx-jlesage
restart: always
environment:
TZ: ${GB_TZ}
volumes:
- '/volume1/docker/nginx/:/config:rw'
network_mode: host
...
I've around 10-15 containers (they are apps or databases)
Every container has it own folder in my /volume/docker/
folder.
Then in order to back up any container data, I simply stop every running container and I copy/paste the /docker/
folder somewhere else (not on my NAS)
Restore data
If I ever need to restore one of my container's data (dead NAS or corrupted file), I would delete the container, delete its data and copy/paste my back up at the same place, then rebuild my container with docker-compose up -d
.
Conclusion
I've seen so much complicated way (like this one How can I backup a Docker-container with its data-volumes?) to do it and I can't figure if my solution is horrible or not and if my data are in danger or not.
I tried deleting my docker folder, then restoring everything using my method, it worked and I'm confused and scared about missing something.