Skip to content

Instantly share code, notes, and snippets.

@keopx
Last active February 12, 2017 13:40
Show Gist options
  • Save keopx/51e37289b2088358b82b to your computer and use it in GitHub Desktop.
Save keopx/51e37289b2088358b82b to your computer and use it in GitHub Desktop.
Stop / remove all Docker containers

Stop all Docker containers

docker stop $(docker ps -a -q)

Remove not running all containers

docker ps -a | grep 'weeks ago' | awk '{print $1}' | xargs --no-run-if-empty docker rm

Delete all Volume

docker volume rm $(docker volume ls -qf dangling=true)

Delete all containers

docker rm $(docker ps -a -q)

Delete all images

docker rmi $(docker images -q)

Clean docker used space.

sudo service docker stop && sudo rm -rf /var/lib/docker && sudo service docker stop && sudo service docker start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment