docker容器删除状态为Removal In Progress

[root@www.moneyslow.com ~]# systemctl restart docker

重启docker后,发现一个容器状态开始为Dead,后来转为 Removal In Progress

[root@www.moneyslow.com ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
e51647849b2a        registry            "/entrypoint.sh /e..."   2 weeks ago         Dead                                    confident_ride
[root@www.moneyslow.com ~]# docker rm e51647849b2a
Error response from daemon: driver "overlay" failed to remove root filesystem for e51647849b2a54f2cc19451811bea3990289cc8b237cf2b73bd4c4093ce8f0d9: remove /var/lib/docker/overlay/94d170fcac04f46108076157153c768094b459c9f92d52097a11c2641253f6bc/merged: device or resource busy
[root@www.moneyslow.com ~]# docker ps -a          
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                PORTS               NAMES
e51647849b2a        registry            "/entrypoint.sh /e..."   2 weeks ago         Removal In Progress                       confident_ride

解决办法:进入到容器目录,查看文件
[root@www.moneyslow.com containers]# pwd
/var/lib/docker/containers
[root@www.moneyslow.com containers]# find .
.
./e51647849b2a54f2cc19451811bea3990289cc8b237cf2b73bd4c4093ce8f0d9
./e51647849b2a54f2cc19451811bea3990289cc8b237cf2b73bd4c4093ce8f0d9/resolv.conf
./e51647849b2a54f2cc19451811bea3990289cc8b237cf2b73bd4c4093ce8f0d9/hosts
./e51647849b2a54f2cc19451811bea3990289cc8b237cf2b73bd4c4093ce8f0d9/e51647849b2a54f2cc19451811bea3990289cc8b237cf2b73bd4c4093ce8f0d9-json.log
./e51647849b2a54f2cc19451811bea3990289cc8b237cf2b73bd4c4093ce8f0d9/resolv.conf.hash
./e51647849b2a54f2cc19451811bea3990289cc8b237cf2b73bd4c4093ce8f0d9/hostconfig.json
./e51647849b2a54f2cc19451811bea3990289cc8b237cf2b73bd4c4093ce8f0d9/checkpoints
./e51647849b2a54f2cc19451811bea3990289cc8b237cf2b73bd4c4093ce8f0d9/config.v2.json
./e51647849b2a54f2cc19451811bea3990289cc8b237cf2b73bd4c4093ce8f0d9/hostname
./e51647849b2a54f2cc19451811bea3990289cc8b237cf2b73bd4c4093ce8f0d9/shm

发现确实有一个容器目录存在,而且id号相同:

[root@www.moneyslow.com containers]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                PORTS               NAMES
e51647849b2a        registry            "/entrypoint.sh /e..."   2 weeks ago         Removal In Progress                       confident_ride
[root@www.moneyslow.com containers]# ll
total 4
drwx------ 4 root root 4096 Nov  9 11:00 e51647849b2a54f2cc19451811bea3990289cc8b237cf2b73bd4c4093ce8f0d9

删除文件并重启:

[root@www.moneyslow.com containers]# rm -rf ./*
[root@www.moneyslow.com containers]# systemctl restart docker
[root@www.moneyslow.com containers]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES