Open alex1702 opened 3 months ago
You certainly can mount the volume as a source, like this
version: '3'
services:
nautical-backup:
image: minituff/nautical-backup:2
container_name: nautical-backup
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /config:/config
- /var/lib/docker/volumes:/app/source # <--- Updated source
- /destination:/app/destination
But the problem you will likely run into is the names of the folder do not match the container names. For example:
➜ cd /var/lib/docker/volumes && ll
total 140K
drwx-----x 3 root root 4.0K Aug 9 15:42 02e233612c1c1a0f413b6e46cd2914857dcb16d9fb585cb45b548744f19c1f1a
drwx-----x 3 root root 4.0K Apr 17 17:31 05a38919f1f3c1f5e26b006e199168a96d0f8cf6c3c80c3911c8ca330573d2b8
drwx-----x 3 root root 4.0K Aug 9 15:36 082b03e351489155b82eed3690e3b666a87f15aa1f5219380bbd05873a7a349a
drwx-----x 3 root root 4.0K Apr 14 20:10 1ee71e95e4a917f9e6c86ac3012c5cdcdcda04bfd47f17b9116f8ab5303b8528
You may be able to get away with using the Override Source Definition configs to have them match. But honestly, if we could use the Docker API to get these folder names it would be so much easier. Maybe we could create an environment variable that would enable this feature.
I am happy to take a look and try to help implement this as well.
I'd love that. Your contributions are welcome.
+1
Is there a way to extend the program so that the path to Docker volumes (/var/lib/docker/volumes - default path on Linux) can be specified as a source? The idea is to use the Docker API to automatically identify existing volumes so they can be backed up accordingly. It should be possible to control the behavior using labels and environment variables.
I am happy to take a look and try to help implement this as well.