-
Notifications
You must be signed in to change notification settings - Fork 100
fix(docker): getting an image by ID or a name with tag #425
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please refer to the original PR.
image/daemon/docker.go
Outdated
imageID = ref.String() // Image ID uses "<Image_ID>" pattern | ||
inspect, _, err = c.ImageInspectWithRaw(context.Background(), imageID) | ||
if err != nil { | ||
return nil, cleanup, xerrors.Errorf("unable to inspect the image (%s): %w", ref.Name(), err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ref.String()
returns an original value. I think ref.String()
is better here.
return nil, cleanup, xerrors.Errorf("unable to inspect the image (%s): %w", ref.Name(), err) | |
return nil, cleanup, xerrors.Errorf("unable to inspect the image (%s): %w", imageID, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
image/daemon/docker.go
Outdated
@@ -24,10 +24,14 @@ func DockerImage(ref name.Reference) (Image, func(), error) { | |||
} | |||
}() | |||
|
|||
imageID := ref.String() | |||
imageID := ref.Name() // Image ID uses "<Image_name>:<Tag>" pattern |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imageID := ref.Name() // Image ID uses "<Image_name>:<Tag>" pattern | |
// <image_name>:<tag> pattern like "alpine:3.15" | |
// or | |
// <image_name>@<digest> pattern like "alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300" | |
imageID := ref.Name() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You missed my suggested change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean digest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, done
image/daemon/docker.go
Outdated
inspect, _, err := c.ImageInspectWithRaw(context.Background(), imageID) | ||
if err != nil { | ||
return nil, cleanup, xerrors.Errorf("unable to inspect the image (%s): %w", imageID, err) | ||
imageID = ref.String() // Image ID uses "<Image_ID>" pattern |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
imageID = ref.String() // Image ID uses "<Image_ID>" pattern | |
imageID = ref.String() // <image_id> pattern like `5ac716b05a9c` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
fanal
tries to find an image by name (with tag).If it's not found,
fanal
will look for an image by ID.Fixes a problem from #405