Remove containers based on state:
docker rm -v $(docker ps --filter status=exited -q)
Note:
- The -v option, which will delete all volumes associated with the containers.
Empty all containers on my development machine:
docker rm -v -f $(docker ps -qa)
Note:
- The option "-f" will force to delete the running container
source share