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
docker volume prune removes ALL volumes when live restore is enabled and unless-stopped restart policy is used #41686
Comments
Could reproduce this bug on a fresh Debian 10.6 VM, following the specified steps. |
Thanks for reporting!
is it only happening with that restart policy? My initial suspicion would be that /cc @cpuguy83 |
Thanks for your answer ! 😁
We only use This issue occurs with So even with live restore enabled, with a |
Hmmm "interesting" 🤔 |
This just happened here as well with the result of losing data. Very dangerous bug, any update on this? |
Can confirm still a problem :P fortunately had backups to roll back to, but would be nice to reconcile state to avoid pruning in-use volumes |
I can confirm that this also can happen without |
Here's a fix for this: #44231 |
Thanks a lot for you investigation and fix, @cpuguy83 ! Do you have a vague idea of when can we hope a release ? |
Note : issue edited to include an additional restart of Docker daemon to really reproduce the issue from scratch.
Description
When live restore is enabled, stopping and restarting the daemon then running
docker volume prune
removes all volumes mounted in containers withunless-stopped
policy.It is very dangerous, as volumes used by running containers will just disappear with no warning.
Steps to reproduce the issue:
Here is a MWE from a fresh Debian 10.
docker
group/etc/docker/daemon.json
with the following content to enable live restore :pica
) :unless-stopped
policy and mount the volume :$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 32749a84d3a6 busybox "sleep 10000" 17 seconds ago Up 16 seconds pica
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 32749a84d3a6 busybox "sleep 10000" About a minute ago Up 38 seconds pica
Describe the results you received:
The
pica
volume is removed whereas thepica
container is still running.Even after the removal, we can still execute a command in the container, showing that it is really still running :
Excerpt of
docker inspect pica
:Obviously the volume has been removed, so :
$ docker volume inspect pica [] Error: No such volume: pica $ sudo ls /var/lib/docker/volumes/pica/_data ls: cannot access '/var/lib/docker/volumes/pica/_data': No such file or directory
Describe the results you expected:
Volumes mounted in running containers should not be removed when running
docker volume prune
.Additional information you deem important (e.g. issue happens only occasionally):
With live restore alone or
unless-stopped
alone,docker volume prune
will not remove volumes mounted in running containers.If a container has been manually restarted after restarting the Docker daemon, the volume won't be removed.
Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.):
Tested with Debian 10 on virtual machines.
The text was updated successfully, but these errors were encountered: