rm: remove write-protected directory '/var/lib/docker'?

Question: What is this error all about? "rm: remove write-protected directory '/var/lib/docker'?" when I tried to remove /var/lib/docker with command below:

sudo rm -R /var/lib/docker

Please Login to see the rest of the answer

Answer: use the following command to force the directory to be removed,
sudo rm -rf /var/lib/dokcer

This should do it. Keep in mind that "r" is for "recursive", it will iterate through the files and remove them and "f" stands for "force" which will force the command to run.

[Note]: It is always not a good idea to force command, the error is telling you something that you have to pay attention to, before your force the command be aware what you might be losing.

The error is not your enemy but your best friend.

Hope this helps.

Write an Article
If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.

@Jerry said:

You are welcome.

Jerry said:

Thank you this helped me.

© 2022 - ErnesTech - Privacy