Bug fix for Get-DockerProcess

Get-Member would error when input was missing.
This commit is contained in:
Gal Szkolnik 2021-06-24 09:47:51 -04:00
parent 8cbb2e2252
commit 90bd351641
1 changed files with 6 additions and 5 deletions

View File

@ -12,11 +12,12 @@ $(docker ps -q) |
Status=$tmp.State.Status
Image=$tmp.Config.Image
Ports=$(
$tmp.HostConfig.PortBindings |
Get-Member -type NoteProperty | Select-Object -ExpandProperty Name |
ForEach-Object {
"$($tmp.HostConfig.PortBindings."$_".HostPort)/$_"
}
if( $tmp.HostConfig -and $tmp.HostConfig.PortBindings ) {
$tmp.HostConfig.PortBindings | Get-Member -type NoteProperty | Select-Object -ExpandProperty Name |
ForEach-Object {
"$($tmp.HostConfig.PortBindings."$_".HostPort)/$_"
}
}
)
Binds= $tmp.HostConfig.Binds
raw = $tmp