| ... | ... |
@@ -627,7 +627,10 @@ func (cli *DockerCli) CmdHistory(args ...string) error {
|
| 627 | 627 |
fmt.Fprintln(w, "ID\tCREATED\tCREATED BY") |
| 628 | 628 |
|
| 629 | 629 |
for _, out := range outs {
|
| 630 |
- fmt.Fprintf(w, "%s (%s)\t%s ago\t%s\n", out.ID, out.Tag, utils.HumanDuration(time.Now().Sub(time.Unix(out.Created, 0))), out.CreatedBy) |
|
| 630 |
+ if out.Tags != nil {
|
|
| 631 |
+ out.ID = out.Tags[0] |
|
| 632 |
+ } |
|
| 633 |
+ fmt.Fprintf(w, "%s \t%s ago\t%s\n", out.ID, utils.HumanDuration(time.Now().Sub(time.Unix(out.Created, 0))), out.CreatedBy) |
|
| 631 | 634 |
} |
| 632 | 635 |
w.Flush() |
| 633 | 636 |
return nil |
| ... | ... |
@@ -218,16 +218,14 @@ func (srv *Server) ImageHistory(name string) ([]APIHistory, error) {
|
| 218 | 218 |
return nil, err |
| 219 | 219 |
} |
| 220 | 220 |
|
| 221 |
- lookupMap := make(map[string]string) |
|
| 221 |
+ lookupMap := make(map[string][]string) |
|
| 222 | 222 |
for name, repository := range srv.runtime.repositories.Repositories {
|
| 223 | 223 |
for tag, id := range repository {
|
| 224 | 224 |
// If the ID already has a reverse lookup, do not update it unless for "latest" |
| 225 |
- if _, exists := lookupMap[id]; exists {
|
|
| 226 |
- if tag != "latest" {
|
|
| 227 |
- continue |
|
| 228 |
- } |
|
| 225 |
+ if _, exists := lookupMap[id]; !exists {
|
|
| 226 |
+ lookupMap[id] = []string{}
|
|
| 229 | 227 |
} |
| 230 |
- lookupMap[id] = name + ":" + tag |
|
| 228 |
+ lookupMap[id] = append(lookupMap[id], name+":"+tag) |
|
| 231 | 229 |
} |
| 232 | 230 |
} |
| 233 | 231 |
|
| ... | ... |
@@ -237,7 +235,7 @@ func (srv *Server) ImageHistory(name string) ([]APIHistory, error) {
|
| 237 | 237 |
out.ID = srv.runtime.repositories.ImageName(img.ShortID()) |
| 238 | 238 |
out.Created = img.Created.Unix() |
| 239 | 239 |
out.CreatedBy = strings.Join(img.ContainerConfig.Cmd, " ") |
| 240 |
- out.Tag = lookupMap[img.ID] |
|
| 240 |
+ out.Tags = lookupMap[img.ID] |
|
| 241 | 241 |
outs = append(outs, out) |
| 242 | 242 |
return nil |
| 243 | 243 |
}) |