From 90bd351641dc8b691c115bc3c6e9ede21bed2aac Mon Sep 17 00:00:00 2001 From: Gal Szkolnik Date: Thu, 24 Jun 2021 09:47:51 -0400 Subject: [PATCH] Bug fix for Get-DockerProcess Get-Member would error when input was missing. --- docker/Get-DockerProcess.ps1 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docker/Get-DockerProcess.ps1 b/docker/Get-DockerProcess.ps1 index 4245f15..ff280cf 100644 --- a/docker/Get-DockerProcess.ps1 +++ b/docker/Get-DockerProcess.ps1 @@ -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