My docker cheat sheet

Management

# Stop all containers.
docker stop $(docker ps -a -q -f "status=running")  

Cleanup

# Remove all containers.
docker rm $(docker ps -a -q -f)  
# Remove stopped containers.
docker rm $(docker ps -a -q -f "status=exited")  
# Remove all images.
docker rm $(docker images -q -f)  
# Remove orphaned images.
docker rmi $(docker images -q -f "dangling=true")  
# Remove orphaned volumes.
docker volume rm $(docker volume ls -q -f "dangling=true")  
comments powered by Disqus