From 98f476815c12cc59c7c12bee3cde3773b6a2048a Mon Sep 17 00:00:00 2001 From: Paul Caskey Date: Wed, 21 Nov 2018 10:53:14 -0600 Subject: [PATCH] Create destroy.ps1 --- bin/windows/destroy.ps1 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 bin/windows/destroy.ps1 diff --git a/bin/windows/destroy.ps1 b/bin/windows/destroy.ps1 new file mode 100644 index 0000000..e384549 --- /dev/null +++ b/bin/windows/destroy.ps1 @@ -0,0 +1,16 @@ + +foreach($line in Get-Content ./common.cmd) { + [Environment]::SetEnvironmentVariable($line.split('=')[0], $line.split('=')[1], "Process") +} +$fullimagename = $($env:maintainer) + '/' + $($env:imagename) + +$result = docker ps -a | grep $($fullimagename) | awk '{print $1}' + +if ( $result ) { + docker rm -f $(docker ps -a | grep $($fullimagename) | awk '{print $1}') + docker rmi -f $($fullimagename) + echo "container/image removed..." +} else { + echo "no container/image found..." +} +