-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
[Feature] Automated backups of all named volumes #446
Comments
I would think this is pretty similar to #329 |
It does massively improve the situation. I REALLY like the idea of using labels at the volume level. That way, I can configure a single backup service, massively cutting down on duplication. And then label volumes when defining them accordingly. However, I do not think it solves the issue of backing up everything automatically. I would really like it if I could set up the defaults via the backup service itself. Eg, adding the following to the service:
Would then stop any containers using a volume by default, since that is the safest thing to do. I could then set the
label at the volume level for those volumes that I know can be backed up safely without stopping the containers that are using it. That way, if I ever forget to set this label for new volumes, it will use the safe option of stopping containers when backing up, which is what I would want it to do. This idea could be extended to other existing labels as well. Eg, define the defaults at the service level, define overrides at the volume level. Furthermore, to deal with the automated backups without any possible way of accidentally forgetting setting this up for newly created volumes, how about we introduce something like:
When this is set, the service would backup all named volumes, even those without any labels at all. We could then also introduce some new label at the volume level that would exclude that particular volume from the automated backup. That way:
I feel my ideas do have a lot of overlap with the existing issue, but it does also introduce some new stuff (mainly the backup-by-default behavior). Would you prefer to keep this is a separate issue, or shall I move this feedback and add it to this existing issue? Thanks! |
Does Docker have the concept of a "named volume"? I.e. if the tool would list all volumes, how would it know which ones are named, and which ones aren't? This probably gets more complicated when running multiple compose stacks on the same host. |
Docker compose labels all names volumes automatically, so generating a list of all named volumes is as easy as running the following command:
|
Alternatively, you can also find all anonymous volumes via this command:
|
Thanks for elaborating. The difficult part when implementing this will be the same as in #329: since Docker can't mount/unmount volumes at runtime, the architecture of this tool - where we have a long running container that does scheduling, Docker interaction as well as backing up - does not work anymore. Instead, one-off containers will need to be spawned for each backup. I'm not opposed to implementing such an approach, but it will require a dedicated effort and is not something that can easily be solved. If anyone wants to work on this I am happy to discuss implementation details. It would probably also make sense to work on this in conjunction with #329. |
Is your feature request related to a problem? Please describe.
I have many different docker-compose files for different services. And I am fairly certain I am not the only one. If I want to add backups I either:
Number 1 has a lot of duplication. Number 2 has a risk of forgetting to mount new named volumes, and not backing them up.
Describe the solution you'd like
Allow this tool to use the docker socket to create a list of ALL named volumes, and back them all up automatically. We could set a default policy for whether to stop containers using a volume or not. We could run an exclude list on volumes NOT to backup. But this way, we will at least have backups for new volumes in changed existing services or entirely new docker compose files by default even if we do not change anything.
Describe alternatives you've considered
Not aware of any alternatives.
The text was updated successfully, but these errors were encountered: