File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -42,9 +42,13 @@ class Image:
42
42
@classmethod
43
43
def from_dict (cls , json_dict : dict ) -> "Image" :
44
44
"""Create an Image object from a json dictionary."""
45
+ image_id = json_dict .get ("Id" , None )
46
+ if image_id and not image_id .startswith ("sha256:" ):
47
+ # Some container engines (e.g., Podman) do not prefix the ID with sha256:
48
+ image_id = f"sha256:{ image_id } "
45
49
return cls (
46
- id = json_dict . get ( "Id" , None ) ,
47
- short_id = json_dict . get ( "Id" , [])[ :19 ],
50
+ id = image_id ,
51
+ short_id = image_id [ :19 ] if image_id else None ,
48
52
tags = json_dict .get ("RepoTags" , None ),
49
53
attrs = json_dict ,
50
54
)
@@ -306,7 +310,7 @@ def image(self) -> Image | None:
306
310
image_id = self .attrs .get ("ImageID" , self .attrs ["Image" ])
307
311
if image_id is None :
308
312
return None
309
- return Images .get (image_id . split ( ":" )[ 1 ] )
313
+ return Images .get (image_id )
310
314
311
315
@property
312
316
def host_port (self ) -> str | None :
You can’t perform that action at this time.
0 commit comments