提交 1df34dc6 编写于 作者: J Jeff Zvier

images: sort by created time when list images

Signed-off-by: Nliuzekun <liuzekun@huawei.com>
上级 f553d725
......@@ -16,6 +16,7 @@ package daemon
import (
"context"
"fmt"
"sort"
"strings"
"github.com/pkg/errors"
......@@ -49,7 +50,9 @@ func (b *Backend) List(ctx context.Context, req *pb.ListRequest) (*pb.ListRespon
if err != nil {
return &pb.ListResponse{}, errors.Wrap(err, "failed list images from local storage")
}
sort.Slice(images, func(i, j int) bool {
return images[i].Created.After(images[j].Created)
})
result := make([]*pb.ListResponse_ImageInfo, 0, len(images))
for _, image := range images {
names := image.Names
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册