File tree Expand file tree Collapse file tree
emhttp/plugins/dynamix.docker.manager/include Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -960,11 +960,22 @@ public function getDockerContainers() {
960960 if (is_array ($ this ::$ containersCache )) return $ this ::$ containersCache ;
961961 $ this ::$ containersCache = [];
962962 foreach ($ this ->getDockerJSON ("/containers/json?all=1 " ) as $ ct ) {
963+ if (!is_array ($ ct ) || empty ($ ct ['Id ' ])) {
964+ continue ;
965+ }
966+ // Docker can leave stale "dead" entries after shutdown races; filter them from the UI list.
967+ if (($ ct ['State ' ] ?? '' ) === 'dead ' || stripos ($ ct ['Status ' ] ?? '' , 'dead ' ) === 0 ) {
968+ continue ;
969+ }
963970 $ info = $ this ->getContainerDetails ($ ct ['Id ' ]);
971+ // If inspect fails for a stale entry, skip it from the UI list.
972+ if (empty ($ info ) || !is_array ($ info ) || !empty ($ info ['message ' ]) || empty ($ info ['Config ' ]) || empty ($ info ['State ' ])) {
973+ continue ;
974+ }
964975 $ c = [];
965976 $ c ['Image ' ] = DockerUtil::ensureImageTag ($ info ['Config ' ]['Image ' ]);
966977 $ c ['ImageId ' ] = $ this ->extractID ($ ct ['ImageID ' ]);
967- $ c ['Name ' ] = substr ( $ info ['Name ' ], 1 );
978+ $ c ['Name ' ] = ltrim (( $ info ['Name ' ] ?? $ ct [ ' Names ' ][ 0 ] ?? '' ), ' / ' );
968979 $ c ['Status ' ] = $ ct ['Status ' ] ?: 'None ' ;
969980 $ c ['Running ' ] = $ info ['State ' ]['Running ' ];
970981 $ c ['Paused ' ] = $ info ['State ' ]['Paused ' ];
You can’t perform that action at this time.
0 commit comments