Add docker-rm-f.sh
authorColin P. Mccabe <colin@cmccabe.xyz>
Tue, 29 Nov 2016 22:18:50 +0000 (14:18 -0800)
committerColin P. Mccabe <colin@cmccabe.xyz>
Tue, 29 Nov 2016 22:18:50 +0000 (14:18 -0800)
docker-rm-f.sh [new file with mode: 0755]

diff --git a/docker-rm-f.sh b/docker-rm-f.sh
new file mode 100755 (executable)
index 0000000..30bd05b
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+docker ps | while read C; do
+    VM_IMAGE=$(echo "${C}" | awk '{print $1}')
+    if [ "x${VM_IMAGE}" == "xCONTAINER" ]; then
+        :
+    else
+        echo "stopping ${VM_IMAGE}..."
+        docker stop "${VM_IMAGE}"
+        echo "removing ${VM_IMAGE}..."
+        docker rm "${@}" "${VM_IMAGE}"
+    fi
+done