-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
volumes wont be deleted since update to docker 23 #4028
Comments
Also seeing this issue. We had to revert to 20.10 because it was filling up disks with no way to recover and causing outages. |
It seems like it's this change in 23 (mentioned in the 23 changelog). When I run this Not clear why this default needed to change |
Yes this sounds like it is related to the mentioned change.
It does mean that upgrading causes volumes which were created prior to 23.0.0 to not be considered for pruning except for when specifying Also if your client uses the older API version it will also get the old behavior. |
Do you suggest to delete everything and recreate every volume ( obv. after backing up to restore after they have been recreated) to get rid of old obsolete configs? |
@Emporea
No, I don't think that should be necessary, it would likely be simpler to use You can also use |
|
Sorry I gave the wrong command in the first line there, |
Thank you. this works and helps me for now. |
I guess that's fine reasoning, but the execution of this change was very strange for multiple reasons:
|
Yeah, the help needs to change to say 'anonymous.'
Same as the help output, PRs welcome.
I'd like to point out you're a tiny minority there -- for the vast majority of users, "Docker deleted my data after I ran
The only part where this possibly needs to propagate is
Agreed, there should be an example of using the all filter in the help text. Please keep in mind that this has been a persistent pain for educators, commercial support, and undercaffinated experts for years. People are here in this thread because they find the behavior change surprising, and yeah, it looks like review missed the docs updates needed (and this is because of the historical incorrect split of client/server logic we are still cleaning up) -- however, please keep in mind that this thread represents the minority of users who find this behavior unexpected or problematic. We certainly can improve here, and there are a lot of valid points, but the happy path for the majority of users is to stop pruning named volumes by default. |
Also, as an aside: the behavior here changed in the daemon (and is dependent on API version) -- an older CLI against a current daemon will see the old behavior, and the new CLI against an older daemon will also see the old behavior. So as we look at improving the docs & help output, we need to figure out how to explain that difference coherently. |
This issue is not directly related to Docker Desktop for Linux; probably would've been best in the https://github.com/moby/moby issue tracker, but I can't move it there because that's in a different org. Let me move this to the docker/cli repository, where another thread was started in #4015 |
Hi, For some reason anonymous volumes are not deleted by prune on our systems since the change:
Doesnt matter what kind of prune I run, the only one that works is the above mentioned filter one (that removes named volumes). |
What happens if you manually try to remove it? Also keep in mind, prune will not prune volumes created before the upgrade (unless you set |
Hi, I just created these volumes with docker-compose (as you can see at the first line, no volume there).
|
|
@sudo-bmitch I'm getting the same behavior as described by @Re4zOon with Edit: With plain
Output of
|
I assume the issue is with the images having built-in volume declarations: |
Thanks for the reports. |
moby/moby#45147 should fix these cases. --- edit -- To clarify, it should fix the case where a volume is created from the image config. |
In previous versions of the Docker API, `system prune --volumes` and `volume prune` would remove all dangling volumes. With API v1.42, this was changed so that only anonymous volumes would be removed unless the all filter was specified. Some of the docs were updated in docker#4218, however, there were a couple of places left that didn't make the anonymous vs named volumes distinction clear. This replaces docker#4079, which was bitrotted by docker#4218. See also docker#4028. Closes docker#4079. Signed-off-by: Ed Morley <[email protected]>
In previous versions of the Docker API, `system prune --volumes` and `volume prune` would remove all dangling volumes. With API v1.42, this was changed so that only anonymous volumes would be removed unless the all filter was specified. Some of the docs were updated in docker#4218, however, there were a couple of places left that didn't make the anonymous vs named volumes distinction clear. This replaces docker#4079, which was bitrotted by docker#4218. See also docker#4028. Closes docker#4079. Signed-off-by: Ed Morley <[email protected]> (cherry picked from commit 6e2e92d) Signed-off-by: Sebastiaan van Stijn <[email protected]>
It would be nice if the change would be cascaded into |
#4497 was accepted and cherry-picked, which addresses the docs/
I'm going to close this for now, as the last set of sharp edges identified here are solved (and will be in the next patch release), but please feel free to continue the discussion or open that follow-up feature request. |
@neersighted just to be precise though, from what I know the |
@neersighted this is the worst update in docker history. |
I spent half a day today on this, I expected that my volumes were being deleted... thank you for changing the behavior and not sending a message to the console that it no longer works as before (without negativity) |
Every time I have to type two commands to test my deployment I think about this thread 🔥 |
Most annoying bug ever! At least mark it deprecated or something. |
I'm trying to wrap my head around what's going on. Did this behavior get rolled back? In the environments I manage, there is a machine where our old script seems to be working as originally desired, and I noticed it is running version I'm not seeing anything that specifically mentions this issue in the Engine 24 or API 1.43 release notes. |
Seems like things may have got really whacked out, or I am whacked out trying to interpret the docs. The 1.42 API (as reported upthread here) only considers anonymous volumes for deletion on a
On the node with Docker 24/API 1.43, the warning message has been updated to match the behavior of the change rolled out in Docker 23/API 1.42; however, the actual behavior seems to have been rolled back and actually prunes our named volumes as we've desired all along:
I'm just illustrating the warning message, not the pruning output. I am fully certain that our Docker 24 node still works as we'd like when typing I did also manage to find another mention of So, is this a bug? Is the "backport" referring to the 😵💫 I'm really sorry if I'm missing something here. |
@boneitis It definitely has not changed. Note: The daemon cannot protect volumes that were created before version 23. |
Thank you @cpuguy83 for the response; the note is helpful to know. However, our deployments, including our machine with Docker 24, fires up around a dozen containers over the course of a day. All of the what-I-understand-to-be-a-variant-of-"named" volumes get purged (on the version 24 node) without the filter-all parameter, as they did pre-23, whereas the machines with Docker 23 still require it. That is, the mounts of which "Type" is |
If its a hex string then it is most likely not a named volume (unless you have something generating strings when you create the volume). |
Please, I just need a bash script to delete everything. No dangling images, "volumes not used by at least one container", or whatever. Everything. What sequence of commands do I need to run to reset Docker to a completely clean slate? |
"docker system prune --volumes" does no longer prune named volumes in Docker 23.0[1][2], so use "docker volume prune --all"[3] for pruning named volumes. [1] docker/cli#4028 [2] moby/moby#44259 [3] docker/cli#4229
I have that aliased as
|
With |
It's been a while since I had looked at this. My best interpretation to the best of my memory was that there were a few pieces that weren't all rolled out at the same time, which resulted in dangling volumes for me. Something like, if a volume was created pre-23, then they would resist pruning attempts on 23 due to missing some metadata label that you'd expect to see from All I remember was that once 23 was far enough back in the rear-view mirror and my production environments were eventually able to create everything (images, containers, artifacts, whathaveyou) afresh from Docker versions no earlier than 24, everything worked with the right single pruning command scripted, without having to accommodate edge cases in versioning or manually intervene with getting the incantation right with the correct flags. Probably the easiest way to roll with it if you're still stuck in the mire of pre-23 post-23 mixed deployments is to peg your Docker Engine API version on your machines to an older value. |
@boneitis You are absolutely correct. |
The info from @boneitis was helpful. We had a bunch of volumes that weren't being removed with |
Since the update to docker 23 unused volumes will not be deleted anymore with
docker volume prune
nordocker system prune --volumes
.The answer is always
Total reclaimed space: 0B
.When I delete the volumes manually I even get these warning when running docker-compose.yml
Error response from daemon: open /var/lib/docker/volumes/docker_volume1/_data: no such file or directory
Whats happening?
The text was updated successfully, but these errors were encountered: