I am unable to remove the dead container, it appears again after i restart the Docker service.
docker ps -a
CONTAINER ID STATUS
11667ef1623
I have tried the suggestions above but didn't work.
Then
docker system prune -a
, it didn't work the first timedocker system prune -a
. This time it works. It will send a warning message and in the end ask "Are you sure you want to continue? y/n? . Ans:y . It will time a time and in the end the dead containers are gone.docker ps -a
IMPORTANT - this is the nuclear option as it destroys all containers + images
Removing container by force worked for me.
docker rm -f <id_of_the_dead_container>
Notes:
Be aware that this command might throw this error
Error response from daemon: Driver devicemapper failed to remove root filesystem <id_of_the_dead_container>: Device is Busy
The mount of your's dead container device mapper should be removed despite this message. That is, you will no longer access this path:
/var/lib/docker/devicemapper/mnt/<id_of_the_dead_container>
Try running the following commands. It always works for me.
# docker volume rm $(docker volume ls -qf dangling=true)
# docker rm $(docker ps -q -f 'status=exited')
After execution of the above commands, restart docker by,
# service docker restart
grep 656cfd09aee399c8ae8c8d3e735fe48d70be6672773616e15579c8de18e2a3b3 /proc/*/mountinfo
then find the pid of 656cfd09aee399c8ae8c8d3e735fe48d70be6672773616e15579c8de18e2a3b3and
and kill it
For Deleting all dead container
docker rm -f $(docker ps --all -q -f status=dead)
For deleting all exited container docker rm -f $(docker ps --all -q -f status=exited)
As I have -f
is necessary
Most likely, an error occurred when the daemon attempted to cleanup the container, and he is now stuck in this "zombie" state.
I'm afraid your only option here is to manually clean it up:
$ sudo rm -rf /var/lib/docker/<storage_driver>/11667ef16239.../
Where <storage_driver>
is the name of your driver (aufs
, overlay
, btrfs
, or devicemapper
).