Skip to content

Instantly share code, notes, and snippets.

@cage1016
Created May 14, 2020 09:40
Show Gist options
  • Save cage1016/16aad252dc74b0cc06efcf58f25a596f to your computer and use it in GitHub Desktop.
Save cage1016/16aad252dc74b0cc06efcf58f25a596f to your computer and use it in GitHub Desktop.
How to Stop and Remove Multiple Docker Containers

Stopping All Containers

$ docker stop $(docker ps -a -q)

Removing All Containers

$ docker rm $(docker ps -a -q)

This makes it 10x easier for when I want to easily start everything over from scratch If you can remove all images/containers then:

docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
docker volume rm $(docker volume ls |awk '{print $2}')
rm -rf ~/Library/Containers/com.docker.docker/Data/*

Remove all untagged images

docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment