You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
939 B

  1. $scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
  2. Write-Host "Current script directory is $scriptPath" -ForegroundColor Yellow
  3. $imagesToDelete = docker images --filter=reference="eshop/*" -q
  4. If (-Not $imagesToDelete) {Write-Host "Not deleting eShop images as there are no eShop images in the current local Docker repo."}
  5. Else
  6. {
  7. # Delete all containers
  8. Write-Host "Deleting all containers in local Docker Host"
  9. docker rm $(docker ps -a -q) -f
  10. # Delete all eshop images
  11. Write-Host "Deleting eShop images in local Docker repo"
  12. Write-Host $imagesToDelete
  13. docker rmi $(docker images --filter=reference="eshop/*" -q) -f
  14. }
  15. # DELETE ALL IMAGES AND CONTAINERS
  16. # Delete all containers
  17. # docker rm $(docker ps -a -q) -f
  18. # Delete all images
  19. # docker rmi $(docker images -q)
  20. #Filter by image name (Has to be complete, cannot be a wildcard)
  21. #docker ps -q --filter=ancestor=eshop/identity.api:dev