I am unable to remove the dead container, it appears again after i restart the Docker service.
docker ps -a CONTAINER ID STATUS 11667ef16239 Dead
Then
docker rm -f 11667ef16239
Then, when I ran the docker ps -a, no docker containers showing.
docker ps -a CONTAINER ID STATUS
However, when I restart the docker service:
service docker restart
And run the docker ps -a again:
docker ps -a CONTAINER ID STATUS 11667ef16239 Dead
To remove one or more Docker containers, use the docker container rm command, followed by the IDs of the containers you want to remove. If you get an error message similar to the one shown below, it means that the container is running. You'll need to stop the container before removing it.
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
).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With