Reputation: 251
I create centos with docker and After I start the container, I would remove a directory where there are other two directories.
and I do :
rm -f -r ./folder
and I obtain:
cannot remove 'folder': Device or resource busy
Anyone can help me?
Upvotes: 13
Views: 40041
Reputation: 801
1- ps aux | grep docker.
From there you can get all processes containing "docker" word
2- #kill <process_id>
3- #rm -rf <thedir>
Upvotes: 0
Reputation: 43
This happened to me, until I closed the code editor VS-Code. Somehow VS code had the folder open so it could not close until the editor was closed.
Upvotes: 3
Reputation: 905
Another pretty much simple answer is following:
1. Close all your terminal windows (bash, shell, etc...)
2. Start a new terminal
3. Execute your command again e.g.:
rm -f -r ./folder
4. done
Hopefully it helps others!
Upvotes: 7
Reputation: 814
if you use windows, it's com.docker.backend.exe , terminate it, everything will ok.
If you know the reason why backend cause this problem, tell me.
Upvotes: 3
Reputation: 742
Maybe you have that folder opened up somewhere. Try lsof
to find the opened folder and then sudo kill <pid>
. Afterwards, I believe you can remove the folder from there.
Upvotes: 0