| ... | ... |
@@ -21,6 +21,7 @@ import ( |
| 21 | 21 |
"path" |
| 22 | 22 |
"path/filepath" |
| 23 | 23 |
"runtime" |
| 24 |
+ "sort" |
|
| 24 | 25 |
"strconv" |
| 25 | 26 |
"strings" |
| 26 | 27 |
"sync" |
| ... | ... |
@@ -1694,16 +1695,13 @@ func (srv *Server) ImageGetCached(imgID string, config *Config) (*Image, error) |
| 1694 | 1694 |
} |
| 1695 | 1695 |
|
| 1696 | 1696 |
// Store the tree in a map of map (map[parentId][childId]) |
| 1697 |
- imageMap := make(map[string]map[string]struct{})
|
|
| 1697 |
+ imageMap := make(map[string][]string) |
|
| 1698 | 1698 |
for _, img := range images {
|
| 1699 |
- if _, exists := imageMap[img.Parent]; !exists {
|
|
| 1700 |
- imageMap[img.Parent] = make(map[string]struct{})
|
|
| 1701 |
- } |
|
| 1702 |
- imageMap[img.Parent][img.ID] = struct{}{}
|
|
| 1699 |
+ imageMap[img.Parent] = append(imageMap[img.Parent], img.ID) |
|
| 1703 | 1700 |
} |
| 1704 |
- |
|
| 1701 |
+ sort.Strings(imageMap[imgID]) |
|
| 1705 | 1702 |
// Loop on the children of the given image and check the config |
| 1706 |
- for elem := range imageMap[imgID] {
|
|
| 1703 |
+ for _, elem := range imageMap[imgID] {
|
|
| 1707 | 1704 |
img, err := srv.runtime.graph.Get(elem) |
| 1708 | 1705 |
if err != nil {
|
| 1709 | 1706 |
return nil, err |