docker rm 的时候,死活删除不了容器,docker kill也不行 ,容器状态是dead,重启docker服务也试过了,不行
想到可能是我迁移过docker容器的存储地址导致的,不太确定原因
参考
https://www.cnblogs.com/jie-fang/p/10279426.html
以下为自己实践过程,建议先看完教程再实践,后面有坑:
[root@instance-ww74cmok-2 libcontainerd]# docker rm proxy
Error response from daemon: Driver overlay2 failed to remove root filesystem 784e737579056e2a2e865b3fcd4ccd32dd8e236005e08f7512ad06441ea48d6d: remove /mnt/docker/data/overlay2/be672677265b39ed177a79f834baf63f4746faf5f73cba3b71c79ddaa024d0a0/merged: device or resource busy
[root@instance-ww74cmok-2 libcontainerd]# grep docker /proc/*/mountinfo|grep be672677265b39ed177a79f834baf63f4746faf5f
/proc/41386/mountinfo:266 260 0:56 / /mnt/docker/data/overlay2/be672677265b39ed177a79f834baf63f4746faf5f73cba3b71c79ddaa024d0a0/merged rw,relatime shared:146 - overlay overlay rw,lowerdir=/mnt/docker/data/overlay2/l/7KZQP373LMR2YNDLGVCOAO6HPD:/mnt/docker/data/overlay2/l/PZMWE2VDX4O2BCHEI2TUZUIPUP:/mnt/docker/data/overlay2/l/3GN3WH2OMZE4VEB667HEX7GIF4:/mnt/docker/data/overlay2/l/JM4S4P76O7CQLRU6JHHGZIAJJR:/mnt/docker/data/overlay2/l/IT54IDZSZAS4SNWJYKGSUITWTO:/mnt/docker/data/overlay2/l/ECULN7DI6S565DMEIVIX43HYJL:/mnt/docker/data/overlay2/l/R6TREWCFOXRYT3ZWIKITG3PEFJ:/mnt/docker/data/overlay2/l/QCCUZ66IANXVWGUUPBU5I4ZFUM:/mnt/docker/data/overlay2/l/ZHH23PQ4HYSHQES3LSLYJQBULT:/mnt/docker/data/overlay2/l/FUPO2U3IUKC7YRB6RZPANPNYGN:/mnt/docker/data/overlay2/l/ZVQEZSR4T4OSRNATTXFEK6WTUC:/mnt/docker/data/overlay2/l/7UIBFOQG7WQR7PDUG2P6T7ED6H:/mnt/docker/data/overlay2/l/Y2LOEGAG3LQ46G6LEMB5MNF5OD:/mnt/docker/data/overlay2/l/UEPEBRKPRX6IRK6FFSBWSRQQNA:/mnt/docker/data/overlay2/l/KWDGJS5UF3SIG3EHH3DYDI4JXE:/mnt/docker/data/overlay2/l/ARQ52BAAQ3X2JOLEG3AQK3H76B:/mnt/docker/data/overlay2/l/2RPDDZH2EPCPKNLGQYLXYFKQHQ,upperdir=/mnt/docker/data/overlay2/be672677265b39ed177a79f834baf63f4746faf5f73cba3b71c79ddaa024d0a0/diff,workdir=/mnt/docker/data/overlay2/be672677265b39ed177a79f834baf63f4746faf5f73cba3b71c79ddaa024d0a0/work
/proc/52227/mountinfo:266 260 0:56 / /mnt/docker/data/overlay2/be672677265b39ed177a79f834baf63f4746faf5f73cba3b71c79ddaa024d0a0/merged rw,relatime shared:146 - overlay overlay rw,lowerdir=/mnt/docker/data/overlay2/l/7KZQP373LMR2YNDLGVCOAO6HPD:/mnt/docker/data/overlay2/l/PZMWE2VDX4O2BCHEI2TUZUIPUP:/mnt/docker/data/overlay2/l/3GN3WH2OMZE4VEB667HEX7GIF4:/mnt/docker/data/overlay2/l/JM4S4P76O7CQLRU6JHHGZIAJJR:/mnt/docker/data/overlay2/l/IT54IDZSZAS4SNWJYKGSUITWTO:/mnt/docker/data/overlay2/l/ECULN7DI6S565DMEIVIX43HYJL:/mnt/docker/data/overlay2/l/R6TREWCFOXRYT3ZWIKITG3PEFJ:/mnt/docker/data/overlay2/l/QCCUZ66IANXVWGUUPBU5I4ZFUM:/mnt/docker/data/overlay2/l/ZHH23PQ4HYSHQES3LSLYJQBULT:/mnt/docker/data/overlay2/l/FUPO2U3IUKC7YRB6RZPANPNYGN:/mnt/docker/data/overlay2/l/ZVQEZSR4T4OSRNATTXFEK6WTUC:/mnt/docker/data/overlay2/l/7UIBFOQG7WQR7PDUG2P6T7ED6H:/mnt/docker/data/overlay2/l/Y2LOEGAG3LQ46G6LEMB5MNF5OD:/mnt/docker/data/overlay2/l/UEPEBRKPRX6IRK6FFSBWSRQQNA:/mnt/docker/data/overlay2/l/KWDGJS5UF3SIG3EHH3DYDI4JXE:/mnt/docker/data/overlay2/l/ARQ52BAAQ3X2JOLEG3AQK3H76B:/mnt/docker/data/overlay2/l/2RPDDZH2EPCPKNLGQYLXYFKQHQ,upperdir=/mnt/docker/data/overlay2/be672677265b39ed177a79f834baf63f4746faf5f73cba3b71c79ddaa024d0a0/diff,workdir=/mnt/docker/data/overlay2/be672677265b39ed177a79f834baf63f4746faf5f73cba3b71c79ddaa024d0a0/work
/proc/52228/mountinfo:266 260 0:56 / /mnt/docker/data/overlay2/be672677265b39ed177a79f834baf63f4746faf5f73cba3b71c79ddaa024d0a0/merged rw,relatime shared:146 - overlay overlay rw,lowerdir=/mnt/docker/data/overlay2/l/7KZQP373LMR2YNDLGVCOAO6HPD:/mnt/docker/data/overlay2/l/PZMWE2VDX4O2BCHEI2TUZUIPUP:/mnt/docker/data/overlay2/l/3GN3WH2OMZE4VEB667HEX7GIF4:/mnt/docker/data/overlay2/l/JM4S4P76O7CQLRU6JHHGZIAJJR:/mnt/docker/data/overlay2/l/IT54IDZSZAS4SNWJYKGSUITWTO:/mnt/docker/data/overlay2/l/ECULN7DI6S565DMEIVIX43HYJL:/mnt/docker/data/overlay2/l/R6TREWCFOXRYT3ZWIKITG3PEFJ:/mnt/docker/data/overlay2/l/QCCUZ66IANXVWGUUPBU5I4ZFUM:/mnt/docker/data/overlay2/l/ZHH23PQ4HYSHQES3LSLYJQBULT:/mnt/docker/data/overlay2/l/FUPO2U3IUKC7YRB6RZPANPNYGN:/mnt/docker/data/overlay2/l/ZVQEZSR4T4OSRNATTXFEK6WTUC:/mnt/docker/data/overlay2/l/7UIBFOQG7WQR7PDUG2P6T7ED6H:/mnt/docker/data/overlay2/l/Y2LOEGAG3LQ46G6LEMB5MNF5OD:/mnt/docker/data/overlay2/l/UEPEBRKPRX6IRK6FFSBWSRQQNA:/mnt/docker/data/overlay2/l/KWDGJS5UF3SIG3EHH3DYDI4JXE:/mnt/docker/data/overlay2/l/ARQ52BAAQ3X2JOLEG3AQK3H76B:/mnt/docker/data/overlay2/l/2RPDDZH2EPCPKNLGQYLXYFKQHQ,upperdir=/mnt/docker/data/overlay2/be672677265b39ed177a79f834baf63f4746faf5f73cba3b71c79ddaa024d0a0/diff,workdir=/mnt/docker/data/overlay2/be672677265b39ed177a79f834baf63f4746faf5f73cba3b71c79ddaa024d0a0/work
You have new mail in /var/spool/mail/root
[root@instance-ww74cmok-2 libcontainerd]# ^C
[root@instance-ww74cmok-2 libcontainerd]# ^C
[root@instance-ww74cmok-2 libcontainerd]# grep docker /proc/*/mountinfo|grep be672677265b39ed177a79f834baf63f4746faf5f | awk -F ":" '{print $1}' | awk -F "/" '{print $3}'
41386
52227
52228
[root@instance-ww74cmok-2 libcontainerd]# ^C
[root@instance-ww74cmok-2 libcontainerd]# kill -9 41386
[root@instance-ww74cmok-2 libcontainerd]# kill -9 52227
[root@instance-ww74cmok-2 libcontainerd]# kill -9 52228
[root@instance-ww74cmok-2 libcontainerd]# docker rm proxy
proxy
[root@instance-ww74cmok-2 libcontainerd]# 说明删除成功!!!!!
按照上面一顿操作后,发现nginx转发异常,项目无法访问
赶紧用这个方法:https://www.jianshu.com/p/19cefdedc3fc
cd /var/run
touch nginx.pid
输入nginx的进程id(master process对应的那个id)
nginx -s reload
发现还是不行,继续执行
nginx -c /etc/nginx/nginx.conf
nginx -s reload
ok,完成!