Skip to content

Instantly share code, notes, and snippets.

@mlhoutel
Last active June 28, 2022 14:12
Show Gist options
  • Save mlhoutel/cb811da804bb7f0a6bedc3af7ba37955 to your computer and use it in GitHub Desktop.
Save mlhoutel/cb811da804bb7f0a6bedc3af7ba37955 to your computer and use it in GitHub Desktop.
@echo off
:: Stop all containers
for /f "tokens=*" %%i in ('docker ps -q') do docker kill %%i
:: Remove all containers
for /f "tokens=*" %%i in ('docker ps -a -q') do docker rm %%i
:: Remove all images
for /f "tokens=*" %%i in ('docker images -q') do docker rmi %%i
:: Remove all networks
docker network prune
:: Remove all volumes
docker volume prune
:: Volumes from docker-compose up must be removed with:
:: docker-compose down --rmi all --volumes
:: ... in the same directory as the Dockerfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment