I am unable to remove the dead container, it appears again after i restart the Docker service.
docker ps -a
CONTAINER ID STATUS
11667ef1623
You can also remove dead
containers with this command
docker rm $(docker ps --all -q -f status=dead)
But, I'm really not sure why & how the dead
containers are created. This error seems related https://github.com/typesafehub/mesos-spark-integration-tests/issues/34 whenever i get dead
containers
[Update] With Docker 1.13 update, we can easily remove both unwanted containers, dangling images
$ docker system df #will show used space, similar to the unix tool df
$ docker system prune # will remove all unused data.
The best way to get rid of dead container processes is to restart your docker service. I was unable to remove a container as it was stuck in restarting status, I just restarted the docker service and it worked for me.
There are a lot of answers in here but none of them involved the (quick) solution that worked for me.
I'm using Docker version 1.12.3, build 6b644ec.
I simply ran docker rmi <image-name>
for the image from whence the dead container came. A docker ps -a
then showed the dead container missing completely.
Then, of course, I just re-pulled the image and ran the container again.
I have no idea how it found itself in this state but so it is...
Tried all of the above (short of reboot/ restart docker).
So here is the error om docker rm:
$ docker rm 08d51aad0e74
Error response from daemon: driver "devicemapper" failed to remove root filesystem for 08d51aad0e74060f54bba36268386fe991eff74570e7ee29b7c4d74047d809aa: remove /var/lib/docker/devicemapper/mnt/670cdbd30a3627ae4801044d32a423284b540c5057002dd010186c69b6cc7eea: device or resource busy
Then I did a the following:
$ grep docker /proc/*/mountinfo | grep 958722d105f8586978361409c9d70aff17c0af3a1970cb3c2fb7908fe5a310ac
/proc/20416/mountinfo:629 574 253:15 / /var/lib/docker/devicemapper/mnt/958722d105f8586978361409c9d70aff17c0af3a1970cb3c2fb7908fe5a310ac rw,relatime shared:288 - xfs /dev/mapper/docker-253:5-786536-958722d105f8586978361409c9d70aff17c0af3a1970cb3c2fb7908fe5a310ac rw,nouuid,attr2,inode64,logbsize=64k,sunit=128,swidth=128,noquota
This got be the PID of the offending process keeping it busy - 20416 (the item after /proc/
So I did a ps -p and to my surprise find:
[devops@dp01app5030 SeGrid]$ ps -p 20416
PID TTY TIME CMD
20416 ? 00:00:19 ntpd
A true WTF moment. So I pair problem solved with Google and found this: Then found this https://github.com/docker/for-linux/issues/124
Turns out I had to restart ntp daemon and that fixed the issue!!!
Try this it worked for me on centos 1) docker container ls -a gives you a list of containers check status which you want to get rid of 2) docker container rm -f 97af2da41b2b not a big fan force flag but does the work to check it worked just fire the command again or list it. 3) continue till we clear all dead containers
Try this it worked for me:
docker rm -f <container_name>
eg. docker rm -f 11667ef16239