Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension of the program for Docker volume backup #304

Open
alex1702 opened this issue Aug 30, 2024 · 2 comments
Open

Extension of the program for Docker volume backup #304

alex1702 opened this issue Aug 30, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@alex1702
Copy link

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.

@Minituff
Copy link
Owner

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.

@Minituff Minituff added the enhancement New feature or request label Sep 9, 2024
@Akruidenberg
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants