您好,登錄后才能下訂單哦!
在安裝部署微服務時,在不同實例機器上需要安裝部署修改docker默認路徑,重新映射到新的磁盤空間,需要刪除默認安裝路徑,有時會碰到無法正常刪除,如下:
rm -rf /var/lib/docker 設備或資源忙
[root@test-master playbooks]# rm -rf /var/lib/docker
rm: 無法刪除"/var/lib/docker/containers/3bee81da15b9cf5a17b5ddbd3f777a3bcacb26f3f9e65f500aee86982c480342/shm": 設備或資源忙
rm: 無法刪除"/var/lib/docker/containers/129b31e3f4663219279832a925cbb656339c48d204593e2e74e79e4574a7851a/shm": 設備或資源忙
rm: 無法刪除"/var/lib/docker/containers/3033a2d03057ef17612139e998d772047b295aa46a022d3944c12c0d93097a3c/shm": 設備或資源忙
問題排查方式如下:
查看docker目前狀態
[root@test-master playbooks]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/docker.service.d
└─custom.conf
Active: active (running) since 二 2019-12-24 14:19:53 CST; 19h ago
Docs: http://docs.docker.com
Main PID: 11695 (dockerd-current)
CGroup: /system.slice/docker.service
├─11490 /usr/bin/docker-containerd-shim-current f01c5fa965a6627e1b463b13ee8bea3e8a7af6c07653842c5730b1d2c31f000b /var/...
├─11695 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=d...
├─11704 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-in...
├─14828 /usr/bin/docker-containerd-shim-current 3033a2d03057ef17612139e998d772047b295aa46a022d3944c12c0d93097a3c /var/...
├─24024 /usr/bin/docker-containerd-shim-current 3bee81da15b9cf5a17b5ddbd3f777a3bcacb26f3f9e65f500aee86982c480342 /var/...
├─24042 /usr/bin/docker-containerd-shim-current 129b31e3f4663219279832a925cbb656339c48d204593e2e74e79e4574a7851a /var/...
└─24186 /usr/bin/docker-containerd-shim-current 8e75a3776132d00ac5834dce9c69a00954f213d0986ab44245f053649b821328 /var/...
接下來看如果停止docker服務運行在刪除如果成功,那就算OK
如果還是提示設備忙,如下:
[root@test-master playbooks]# systemctl stop docker
[root@test-master playbooks]# rm -rf /var/lib/docker
rm: 無法刪除"/var/lib/docker/containers/3bee81da15b9cf5a17b5ddbd3f777a3bcacb26f3f9e65f500aee86982c480342/shm": 設備或資源忙
rm: 無法刪除"/var/lib/docker/containers/129b31e3f4663219279832a925cbb656339c48d204593e2e74e79e4574a7851a/shm": 設備或資源忙
rm: 無法刪除"/var/lib/docker/containers/3033a2d03057ef17612139e998d772047b295aa46a022d3944c12c0d93097a3c/shm": 設備或資源忙
rm: 無法刪除"/var/lib/docker/overlay2/c01587998e5dd5ca2e51b3414f528367234615d9c48f589e7abf3b03394c798a/merged": 設備或資源忙
rm: 無法刪除"/var/lib/docker/overlay2/e28014890386bc9a1b5824daa46a6b5085db99db981e1e86ca77669e6670215e/merged": 設備或資源忙
rm: 無法刪除"/var/lib/docker/overlay2/91bac1b5198296322b23eafd80a58503a2f0ef1d05802483e02b726384bc3991/merged": 設備或資源忙
rm: 無法刪除"/var/lib/docker/overlay2/4ddb10bbce9c009aabbadc958c17b81682b74660e167384c8fa32d512a87413d/merged": 設備或資源忙
如上問題提示說明,containers、overlay2這個容器文件需要重新掛載才行,如下查看
[root@test-master ~]# ls -l /var/lib/docker
總用量 0
drwx------. 2 root root 6 12月 25 10:23 containers
drwx------. 2 root root 6 12月 25 10:23 overlay2
[root@test-master ~]#
[root@test-master ~]# umount /var/lib/docker/containers/
[root@test-master ~]# umount /var/lib/docker/overlay2/
在刪除即可。
[root@test-master ~]# rm -rf /var/lib/docker
[root@test-master ~]#
[root@test-master ~]#
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。