@@ -327,12 +327,12 @@ func GenerateExternalContainerFilterFuncs(filter string, filterValues []string,
327
327
switch filter {
328
328
case "id" :
329
329
return func (listContainer * types.ListContainer ) bool {
330
- return filters .FilterID (listContainer .ContainerID () , filterValues )
330
+ return filters .FilterID (listContainer .ID , filterValues )
331
331
}, nil
332
332
case "name" :
333
333
// we only have to match one name
334
334
return func (listContainer * types.ListContainer ) bool {
335
- namesList := listContainer .NamesList ()
335
+ namesList := listContainer .Names
336
336
337
337
for _ , f := range filterValues {
338
338
f = strings .ReplaceAll (f , "/" , "" )
@@ -345,26 +345,25 @@ func GenerateExternalContainerFilterFuncs(filter string, filterValues []string,
345
345
}, nil
346
346
case "command" :
347
347
return func (listContainer * types.ListContainer ) bool {
348
- return util .StringMatchRegexSlice (listContainer .Commands () [0 ], filterValues )
348
+ return util .StringMatchRegexSlice (listContainer .Command [0 ], filterValues )
349
349
}, nil
350
350
case "ancestor" :
351
351
// This needs to refine to match docker
352
352
// - ancestor=(<image-name>[:tag]|<image-id>| ⟨image@digest⟩) - containers created from an image or a descendant.
353
353
return func (listContainer * types.ListContainer ) bool {
354
354
for _ , filterValue := range filterValues {
355
- rootfsImageID , rootfsImageName := listContainer .ImageInfo ()
356
355
var imageTag string
357
356
var imageNameWithoutTag string
358
357
// Compare with ImageID, ImageName
359
358
// Will match ImageName if running image has tag latest for other tags exact complete filter must be given
360
- name , tag , hasColon := strings .Cut (rootfsImageName , ":" )
359
+ name , tag , hasColon := strings .Cut (listContainer . Image , ":" )
361
360
if hasColon {
362
361
imageNameWithoutTag = name
363
362
imageTag = tag
364
363
}
365
364
366
- if (rootfsImageID == filterValue ) ||
367
- util .StringMatchRegexSlice (rootfsImageName , filterValues ) ||
365
+ if (listContainer . ImageID == filterValue ) ||
366
+ util .StringMatchRegexSlice (listContainer . Image , filterValues ) ||
368
367
(util .StringMatchRegexSlice (imageNameWithoutTag , filterValues ) && imageTag == "latest" ) {
369
368
return true
370
369
}
@@ -390,7 +389,7 @@ func GenerateExternalContainerFilterFuncs(filter string, filterValues []string,
390
389
}
391
390
392
391
return func (listContainer * types.ListContainer ) bool {
393
- return createTime .After (listContainer .CreatedTime () )
392
+ return createTime .After (listContainer .Created )
394
393
}, nil
395
394
case "since" :
396
395
var createTime time.Time
@@ -411,15 +410,15 @@ func GenerateExternalContainerFilterFuncs(filter string, filterValues []string,
411
410
}
412
411
413
412
return func (listContainer * types.ListContainer ) bool {
414
- return createTime .Before (listContainer .CreatedTime () )
413
+ return createTime .Before (listContainer .Created )
415
414
}, nil
416
415
case "until" :
417
416
until , err := filters .ComputeUntilTimestamp (filterValues )
418
417
if err != nil {
419
418
return nil , err
420
419
}
421
420
return func (listContainer * types.ListContainer ) bool {
422
- if ! until .IsZero () && listContainer .CreatedTime () .Before (until ) {
421
+ if ! until .IsZero () && listContainer .Created .Before (until ) {
423
422
return true
424
423
}
425
424
return false
0 commit comments