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 Status=$tmp.State.Status
Image=$tmp.Config.Image Image=$tmp.Config.Image
Ports=$( Ports=$(
$tmp.HostConfig.PortBindings | if( $tmp.HostConfig -and $tmp.HostConfig.PortBindings ) {
Get-Member -type NoteProperty | Select-Object -ExpandProperty Name | $tmp.HostConfig.PortBindings | Get-Member -type NoteProperty | Select-Object -ExpandProperty Name |
ForEach-Object { ForEach-Object {
"$($tmp.HostConfig.PortBindings."$_".HostPort)/$_" "$($tmp.HostConfig.PortBindings."$_".HostPort)/$_"
} }
}
) )
Binds= $tmp.HostConfig.Binds Binds= $tmp.HostConfig.Binds
raw = $tmp raw = $tmp