Docker Stuff I Keep Forgetting

Docker commands I am always forgetting:

Stop all running containers
docker stop $(docker ps -a -q)
Remove all stopped containers
docker rm $(docker ps -a -q)
Stop and Remove all containers
docker rm -f $(docker ps -a -q)
Remove all images
docker rmi $(docker images -q)
Bash in a running container:

 docker exec -it <containerIdOrName> bash

Leave a Reply