Skip to content

Commit df242ba

Browse files
committed
Correctly parse and report local image names
A recent commit[1] added the ability to analyze local images by adding the `docker-daemon:` string before the image name. While this works from an analysis point of view, it yields the incorrect string for the container name in Tern's reporting. As a fix, this new commit removes the `docker-daemon` string when instantiating a new OCIImage or DockerImage object, yielding the correct image name in the reports. [1]40b981c Resolves #1214 Resolves #1212 Signed-off-by: Rose Judge <[email protected]>
1 parent b45e584 commit df242ba

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tern/analyze/default/container/image.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@
2626

2727
def load_full_image(image_tag_string, image_type='oci', load_until_layer=0):
2828
"""Create image object from image name and tag and return the object.
29-
The kind of image object is created based on the image_type.
29+
* The kind of image object is created based on the image_type.
3030
image_type = oci OR docker
31-
Loads only as many layers as needed."""
31+
* Loads only as many layers as needed.
32+
* Remove docker-daemon prefix for local images"""
3233
if image_type == 'oci':
33-
image = OCIImage(image_tag_string)
34+
image = OCIImage(image_tag_string.replace('docker-daemon:', ''))
3435
elif image_type == 'docker':
35-
image = DockerImage(image_tag_string)
36+
image = DockerImage(image_tag_string.replace('docker-daemon:', ''))
3637
failure_origin = formats.image_load_failure.format(
3738
testimage=image.repotag)
3839
try:

0 commit comments

Comments
 (0)