Created
February 11, 2020 15:29
-
-
Save TheToddLuci0/fb31f5532fa1a7cb980be4a8ca06f214 to your computer and use it in GitHub Desktop.
Helper script to make killing background docker containers easier
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Script to kill docker containers running in the background | |
.PARAMETER target | |
The line number of `docker ps` output that represents the container to kill | |
.NOTES | |
Author: @TheToddLuci0 | |
#> | |
$s=docker ps | |
$kill_target=1 | |
if($Args[0]){ | |
$kill_target=$Args[0] | |
} | |
$s.split([Environment]::NewLine)[$kill_target].split()[-1] | %{&"docker" kill $_} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment