mirror of
https://github.com/unraid/webgui.git
synced 2026-04-22 10:08:25 -05:00
Fix docker updates occasionally trying to remove wrong image
https://forums.lime-technology.com/topic/57985-docker-failure-to-remove-orphan-image-due-to-similar-named-image/ Also handles rare edge case of multiple containers installed with different tags all referring to an identical image at the time of upgrade
This commit is contained in:
@@ -896,15 +896,19 @@ class DockerClient {
|
||||
|
||||
|
||||
public function getImageID($Image) {
|
||||
if ( ! strpos($Image,":") ) {
|
||||
$Image .= ":latest";
|
||||
}
|
||||
foreach ($this->getDockerImages() as $img) {
|
||||
if (preg_match("%" . preg_quote($Image, "%") . "%", $img["Tags"][0])) {
|
||||
return $img["Id"];
|
||||
foreach ($img['Tags'] as $tag) {
|
||||
if ( $Image == $tag ) {
|
||||
return $img["Id"];
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public function getImageName($id) {
|
||||
foreach ($this->getDockerImages() as $img) {
|
||||
if ($img['Id'] == $id) {
|
||||
@@ -914,7 +918,6 @@ class DockerClient {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private function usedBy($imageId) {
|
||||
$out = [];
|
||||
foreach ($this->getDockerContainers() as $ct) {
|
||||
|
||||
Reference in New Issue
Block a user