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
fin cleanup
should only prune Docksal volumes and images
#1056
Comments
Why do you want to keep a volume that is not used in any container? |
fin cleanup
should prune Docksal itemsfin cleanup
should only prune Docksal items
While there can be number of reasons to have such volumes, mine is that they house data common to my workflow. I attach them to different projects as and when I need them. Sometimes they are dangling if I accidentally restarted my system without executing proper shutdown process for containers. But there are also days where I don't have any containers where I have them attached. I use plain Dockerfiles, docker-compose.yml, Ansible, and Devilbox as needed. Being a contractor, I often find myself in situation where I have to follow existing devops guideline of my clients. As such, I would have a lot of non Docksal images/containers/networks/volumes on my system which I don't want Docksal to manage. TBH volumes are the an aspect of Docker which is not outright disposable in dev environments. I think the gist of opening this issue was to express a concern that "Should Docksal, or any wrapper utility, manipulate things which it has not created or is not controlling, especially when the action is destructive?". |
I understand the gist, bit I wanted to see if it was purely theoretical use case or a real-world use case that you meet more than once. Thanks. |
fin cleanup
should only prune Docksal itemsfin cleanup
should only prune Docksal volumes
My apologies if I went overboard. It wasn't intentional. I wanted to describe the use-case as much as I can and mainly the side-effects. Also, I need to better manage tabbing. Closing the issue wasn't intentional either. (p.-) |
On one hand However on the other hand we use cleanup in the So action items for this ticket will be:
The vision might shift but it should set the direction for this enhancement. |
fin cleanup
should only prune Docksal volumesfin cleanup
should only prune Docksal volumes and images
Adding new flags may break some existing workflows IMHO. Adding the current destructive volumes pruning behavior to While with just OR code below can be changed to Line 1321 in 17edb35
Adding |
Documentation also lists Imagine a use-case where a Dev or Ops person wanted to try Docksal because they hear great things about it at a meetup. Now, after their testing they may want to remove it for time being. While following the docs to the letter they will be left with all their other data pruned. This is an unwarranted side-effect. And this was me today. About design choicesIn development tools it is okay to have some non-destructive side-effects, such as performance hit due to Xdebug or large project size due to node packages. Although, touching non core items is always a bad design choice with unwarranted side-effects. This can lead someone to debugging hell. Those who don't really know much about Docker internals would not know why their data from other non-Docksal project vanished. Those with know-how, may also loose essential work/data because they might already are an advance user with customization here & there. |
Documentation on cleanup clearly states that cleanup Those who don't really know much about Docker internals would not have a volume they need that is unattached to a container, since it is a very advanced use case IMHO. The use of |
@dhavalgshah thanks for bringing this up. While the "valuable dangling volume" use case is indeed advanced and most users won't ever run into it, we definitely do not want the default behavior for
It used to be that way, but had to be changed exactly because named volumes would not be removed with the
This sounds like the best course of action, except we'll have to start labeling all volumes managed within Docksal with a single consistent label (e.g.,
|
My take on the solution ^ (#1058) |
Description
fin cleanup
prunes every unused volume. This may be okay if one only uses Docksal for all Docker usage. However, in many cases, devs have multiple additional Docker images, containers, volumes, and networks depending on their needs.In Docker volumes pruning, "unused" volumes ares determined at the time when the command is run. There is no way to automagically determine if a volume is truly undesired.
In my case, I nearly lost all my reports, DB data, and shared configs stored on named volumes for which containers were stopped/removed. Thanks to backups, I didn't lost hours of test reports.
Steps to reproduce the issue:
fin cleanup
.Describe the results you received:
You would loose all your volumes (if any) from Step 1 even if they aren't related to Docksal.
Describe the results you expected:
Docksal commands should only affect items it creates and manages. Global system wide implications are undesirable. Further to this, there aren't any warnings shown to users before doing this destructive operation.
#582 discusses granular clean-up but does mainly focus on networking issues.
docker volume prune -f 2>/dev/null
should be reconsidered as it removes all unused volumes.Instead
docker volume prune -f --filter 'label=io.docksal.project-root' 2>/dev/null
or similar should be used so not to affect other volumes.Output of
fin config
:fin config output
Output of
fin sysinfo
:fin sysinfo output
The text was updated successfully, but these errors were encountered: