Toshimaru's Blog

Remove old Docker containers


Since Docker 1.13.x you can use Docker container prune:

docker container prune

How to remove old Docker containers - Stack Overflow

docker prune commands

$ docker container prune
$ docker system prune


When you run docker ps -a, you might have too many containers and want to remove old containers. you can remove those containers as below:

$ docker rm `docker ps -aq`

If specified container is running, you’ll get an error:

Failed to remove container (f6259edb8236): Error response from daemon: Conflict, You cannot remove a running container. Stop the container before attempting removal or use -f
Load more