Skip to content

Commit 68dfa11

Browse files
support case for default latest tag in docker-compose
1 parent bd17b99 commit 68dfa11

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/services/realtimeengine/containersrealtime/containers-realtime.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func mergeImagesToResults(listOfImages []wrappers.ContainerImageResponseItem, re
218218

219219
func getImageLocations(images *[]types.ImageModel, imageName, imageTag string) (location []realtimeengine.Location, filePath string) {
220220
for i, img := range *images {
221-
if img.Name == imageName+":"+imageTag || img.Name == imageName+"@"+imageTag {
221+
if isSameImage(img.Name, imageName, imageTag) {
222222
location := convertLocations(&img.ImageLocations)
223223
filePath := ""
224224
if len(img.ImageLocations) > 0 {
@@ -231,6 +231,10 @@ func getImageLocations(images *[]types.ImageModel, imageName, imageTag string) (
231231
return []realtimeengine.Location{}, ""
232232
}
233233

234+
func isSameImage(curImage, imageName, imageTag string) bool {
235+
return curImage == imageName+":"+imageTag || curImage == imageName+"@"+imageTag || curImage == imageName && imageTag == "latest"
236+
}
237+
234238
// splitToImageAndTag splits the image string into name and tag components.
235239
func splitToImageAndTag(image string) (imageName, imageTag string) {
236240
// Split the image string by the last colon to separate name and tag

0 commit comments

Comments
 (0)