Categories
Cloud Coding DevOps Fedora

Failed unmounting /var/lib/docker

From time to time my desktop would hang when shutting down or rebooting it. Looking at the services output, I found this message:

"failed unmounting /var/lib/docker"

Although the reason is quite obvious, the root cause is not so easy to figure out. Also, it’s one of those scary situations where there’s simply not enough results on Google – and the ones there, don’t really help. Not really a good way to start your day.

If you are lucky enough, you might have the same root cause as me: using the --restart=always option on your docker run command.

In my case, I found this out when running kind, because the kind create cluster command seems to create the images with this option (and it doesn’t seem configurable from kind).

So, to work-around this problem:

  • On kind, remember to delete your cluster before the shutdown.
  • On docker,
    • use systemd to manage your containers, or
    • restart them manually

Maybe there’s other ways, but without much research, these seem the easiest ones. Lastly, this happened to me when using Fedora, but I wouldn’t be entirely surprised if it happened on other distributions such as CentOS Stream or Ubuntu.

By Otavio Piske

Just another nerd

Leave a Reply

Your email address will not be published.