This reverts commit 945fc9d882324ac87505e34bb74e6ebe30be1309.
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
| ... | ... |
@@ -47,9 +47,9 @@ func (cli *DockerCli) CmdHistory(args ...string) error {
|
| 47 | 47 |
} |
| 48 | 48 |
if !*quiet {
|
| 49 | 49 |
if *human {
|
| 50 |
- fmt.Fprintf(w, "\t%s ago\t", units.HumanDuration(time.Now().UTC().Sub(entry.Created))) |
|
| 50 |
+ fmt.Fprintf(w, "\t%s ago\t", units.HumanDuration(time.Now().UTC().Sub(time.Unix(entry.Created, 0)))) |
|
| 51 | 51 |
} else {
|
| 52 |
- fmt.Fprintf(w, "\t%s\t", entry.Created.Format(time.RFC3339)) |
|
| 52 |
+ fmt.Fprintf(w, "\t%s\t", time.Unix(entry.Created, 0).Format(time.RFC3339)) |
|
| 53 | 53 |
} |
| 54 | 54 |
|
| 55 | 55 |
if *noTrunc {
|
| ... | ... |
@@ -109,9 +109,9 @@ func (cli *DockerCli) CmdImages(args ...string) error {
|
| 109 | 109 |
|
| 110 | 110 |
if !*quiet {
|
| 111 | 111 |
if *showDigests {
|
| 112 |
- fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s ago\t%s\n", repo, tag, digest, ID, units.HumanDuration(time.Now().UTC().Sub(image.Created)), units.HumanSize(float64(image.VirtualSize))) |
|
| 112 |
+ fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s ago\t%s\n", repo, tag, digest, ID, units.HumanDuration(time.Now().UTC().Sub(time.Unix(int64(image.Created), 0))), units.HumanSize(float64(image.VirtualSize))) |
|
| 113 | 113 |
} else {
|
| 114 |
- fmt.Fprintf(w, "%s\t%s\t%s\t%s ago\t%s\n", repo, tag, ID, units.HumanDuration(time.Now().UTC().Sub(image.Created)), units.HumanSize(float64(image.VirtualSize))) |
|
| 114 |
+ fmt.Fprintf(w, "%s\t%s\t%s\t%s ago\t%s\n", repo, tag, ID, units.HumanDuration(time.Now().UTC().Sub(time.Unix(int64(image.Created), 0))), units.HumanSize(float64(image.VirtualSize))) |
|
| 115 | 115 |
} |
| 116 | 116 |
} else {
|
| 117 | 117 |
fmt.Fprintln(w, ID) |
| ... | ... |
@@ -151,7 +151,7 @@ func (cli *DockerCli) CmdPs(args ...string) error {
|
| 151 | 151 |
} |
| 152 | 152 |
|
| 153 | 153 |
fmt.Fprintf(w, "%s\t%s\t%s\t%s ago\t%s\t%s\t%s\t", ID, image, command, |
| 154 |
- units.HumanDuration(time.Now().UTC().Sub(container.Created)), |
|
| 154 |
+ units.HumanDuration(time.Now().UTC().Sub(time.Unix(int64(container.Created), 0))), |
|
| 155 | 155 |
container.Status, api.DisplayablePorts(container.Ports), strings.Join(names, ",")) |
| 156 | 156 |
|
| 157 | 157 |
if *size {
|
| ... | ... |
@@ -353,37 +353,6 @@ func (s *Server) getImagesJSON(version version.Version, w http.ResponseWriter, r |
| 353 | 353 |
return err |
| 354 | 354 |
} |
| 355 | 355 |
|
| 356 |
- // For version >= 1.19 the Created filed of image will change |
|
| 357 |
- // from int64 to time.Time. |
|
| 358 |
- // This is for legacy data format. |
|
| 359 |
- if version.LessThan("1.19") {
|
|
| 360 |
- type legacyImage struct {
|
|
| 361 |
- ID string `json:"Id"` |
|
| 362 |
- ParentId string |
|
| 363 |
- RepoTags []string |
|
| 364 |
- RepoDigests []string |
|
| 365 |
- Created int64 |
|
| 366 |
- Size int |
|
| 367 |
- VirtualSize int |
|
| 368 |
- Labels map[string]string |
|
| 369 |
- } |
|
| 370 |
- |
|
| 371 |
- legacy := []*legacyImage{}
|
|
| 372 |
- for _, img := range images {
|
|
| 373 |
- l := &legacyImage{
|
|
| 374 |
- ID: img.ID, |
|
| 375 |
- ParentId: img.ParentId, |
|
| 376 |
- RepoTags: img.RepoTags, |
|
| 377 |
- RepoDigests: img.RepoDigests, |
|
| 378 |
- Created: img.Created.Unix(), |
|
| 379 |
- Size: img.Size, |
|
| 380 |
- VirtualSize: img.VirtualSize, |
|
| 381 |
- Labels: img.Labels, |
|
| 382 |
- } |
|
| 383 |
- legacy = append(legacy, l) |
|
| 384 |
- } |
|
| 385 |
- return writeJSON(w, http.StatusOK, legacy) |
|
| 386 |
- } |
|
| 387 | 356 |
return writeJSON(w, http.StatusOK, images) |
| 388 | 357 |
} |
| 389 | 358 |
|
| ... | ... |
@@ -513,34 +482,6 @@ func (s *Server) getImagesHistory(version version.Version, w http.ResponseWriter |
| 513 | 513 |
return err |
| 514 | 514 |
} |
| 515 | 515 |
|
| 516 |
- // For version >= 1.19 the Created filed of image will change |
|
| 517 |
- // from int64 to time.Time. |
|
| 518 |
- // This is for legacy data format. |
|
| 519 |
- if version.LessThan("1.19") {
|
|
| 520 |
- type legacyImageHistory struct {
|
|
| 521 |
- ID string `json:"Id"` |
|
| 522 |
- Created int64 |
|
| 523 |
- CreatedBy string |
|
| 524 |
- Tags []string |
|
| 525 |
- Size int64 |
|
| 526 |
- Comment string |
|
| 527 |
- } |
|
| 528 |
- |
|
| 529 |
- legacy := []*legacyImageHistory{}
|
|
| 530 |
- for _, img := range history {
|
|
| 531 |
- l := &legacyImageHistory{
|
|
| 532 |
- ID: img.ID, |
|
| 533 |
- Created: img.Created.Unix(), |
|
| 534 |
- CreatedBy: img.CreatedBy, |
|
| 535 |
- Tags: img.Tags, |
|
| 536 |
- Size: img.Size, |
|
| 537 |
- Comment: img.Comment, |
|
| 538 |
- } |
|
| 539 |
- legacy = append(legacy, l) |
|
| 540 |
- } |
|
| 541 |
- return writeJSON(w, http.StatusOK, legacy) |
|
| 542 |
- } |
|
| 543 |
- |
|
| 544 | 516 |
return writeJSON(w, http.StatusOK, history) |
| 545 | 517 |
} |
| 546 | 518 |
|
| ... | ... |
@@ -600,42 +541,6 @@ func (s *Server) getContainersJSON(version version.Version, w http.ResponseWrite |
| 600 | 600 |
return err |
| 601 | 601 |
} |
| 602 | 602 |
|
| 603 |
- // For version >= 1.19 the Created filed of container will change |
|
| 604 |
- // from int64 to time.Time. |
|
| 605 |
- // This is for legacy data format. |
|
| 606 |
- if version.LessThan("1.19") {
|
|
| 607 |
- type legacyContainer struct {
|
|
| 608 |
- ID string `json:"Id"` |
|
| 609 |
- Names []string `json:",omitempty"` |
|
| 610 |
- Image string `json:",omitempty"` |
|
| 611 |
- Command string `json:",omitempty"` |
|
| 612 |
- Created int64 `json:",omitempty"` |
|
| 613 |
- Ports []types.Port `json:",omitempty"` |
|
| 614 |
- SizeRw int `json:",omitempty"` |
|
| 615 |
- SizeRootFs int `json:",omitempty"` |
|
| 616 |
- Labels map[string]string `json:",omitempty"` |
|
| 617 |
- Status string `json:",omitempty"` |
|
| 618 |
- } |
|
| 619 |
- |
|
| 620 |
- legacyContainers := []*legacyContainer{}
|
|
| 621 |
- for _, c := range containers {
|
|
| 622 |
- lc := &legacyContainer{
|
|
| 623 |
- ID: c.ID, |
|
| 624 |
- Names: c.Names, |
|
| 625 |
- Image: c.Image, |
|
| 626 |
- Command: c.Command, |
|
| 627 |
- Created: c.Created.Unix(), |
|
| 628 |
- Ports: c.Ports, |
|
| 629 |
- SizeRw: c.SizeRw, |
|
| 630 |
- SizeRootFs: c.SizeRootFs, |
|
| 631 |
- Labels: c.Labels, |
|
| 632 |
- Status: c.Status, |
|
| 633 |
- } |
|
| 634 |
- legacyContainers = append(legacyContainers, lc) |
|
| 635 |
- } |
|
| 636 |
- return writeJSON(w, http.StatusOK, legacyContainers) |
|
| 637 |
- } |
|
| 638 |
- |
|
| 639 | 603 |
return writeJSON(w, http.StatusOK, containers) |
| 640 | 604 |
} |
| 641 | 605 |
|
| ... | ... |
@@ -50,7 +50,7 @@ type ContainerChange struct {
|
| 50 | 50 |
// GET "/images/{name:.*}/history"
|
| 51 | 51 |
type ImageHistory struct {
|
| 52 | 52 |
ID string `json:"Id"` |
| 53 |
- Created time.Time |
|
| 53 |
+ Created int64 |
|
| 54 | 54 |
CreatedBy string |
| 55 | 55 |
Tags []string |
| 56 | 56 |
Size int64 |
| ... | ... |
@@ -69,7 +69,7 @@ type Image struct {
|
| 69 | 69 |
ParentId string |
| 70 | 70 |
RepoTags []string |
| 71 | 71 |
RepoDigests []string |
| 72 |
- Created time.Time |
|
| 72 |
+ Created int |
|
| 73 | 73 |
Size int |
| 74 | 74 |
VirtualSize int |
| 75 | 75 |
Labels map[string]string |
| ... | ... |
@@ -105,7 +105,7 @@ type Container struct {
|
| 105 | 105 |
Names []string `json:",omitempty"` |
| 106 | 106 |
Image string `json:",omitempty"` |
| 107 | 107 |
Command string `json:",omitempty"` |
| 108 |
- Created time.Time `json:",omitempty"` |
|
| 108 |
+ Created int `json:",omitempty"` |
|
| 109 | 109 |
Ports []Port `json:",omitempty"` |
| 110 | 110 |
SizeRw int `json:",omitempty"` |
| 111 | 111 |
SizeRootFs int `json:",omitempty"` |
| ... | ... |
@@ -149,7 +149,7 @@ func (daemon *Daemon) Containers(config *ContainersConfig) ([]*types.Container, |
| 149 | 149 |
} else {
|
| 150 | 150 |
newC.Command = fmt.Sprintf("%s", container.Path)
|
| 151 | 151 |
} |
| 152 |
- newC.Created = container.Created.UTC() |
|
| 152 |
+ newC.Created = int(container.Created.Unix()) |
|
| 153 | 153 |
newC.Status = container.State.String() |
| 154 | 154 |
|
| 155 | 155 |
newC.Ports = []types.Port{}
|
| ... | ... |
@@ -58,24 +58,6 @@ disconnect |
| 58 | 58 |
|
| 59 | 59 |
This endpoint now accepts a `since` timestamp parameter. |
| 60 | 60 |
|
| 61 |
-`GET /images/json` |
|
| 62 |
- |
|
| 63 |
-**New!** |
|
| 64 |
-The `Created` field is now formatted as a RFC3339 string instead of a UNIX |
|
| 65 |
-timestamp, to be consistent with other parts of the API. |
|
| 66 |
- |
|
| 67 |
-`GET /containers/json` |
|
| 68 |
- |
|
| 69 |
-**New!** |
|
| 70 |
-The `Created` field is now formatted as a RFC3339 string instead of a UNIX |
|
| 71 |
-timestamp, to be consistent with other parts of the API. |
|
| 72 |
- |
|
| 73 |
-`GET /images/(name)/history` |
|
| 74 |
- |
|
| 75 |
-**New!** |
|
| 76 |
-The `Created` field is now formatted as a RFC3339 string instead of a UNIX |
|
| 77 |
-timestamp, to be consistent with other parts of the API. |
|
| 78 |
- |
|
| 79 | 61 |
## v1.18 |
| 80 | 62 |
|
| 81 | 63 |
### Full documentation |
| ... | ... |
@@ -38,7 +38,7 @@ List containers |
| 38 | 38 |
"Id": "8dfafdbc3a40", |
| 39 | 39 |
"Image": "ubuntu:latest", |
| 40 | 40 |
"Command": "echo 1", |
| 41 |
- "Created": "2015-03-28T08:19:30.820225442Z", |
|
| 41 |
+ "Created": 1367854155, |
|
| 42 | 42 |
"Status": "Exit 0", |
| 43 | 43 |
"Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
|
| 44 | 44 |
"SizeRw": 12288, |
| ... | ... |
@@ -48,7 +48,7 @@ List containers |
| 48 | 48 |
"Id": "9cd87474be90", |
| 49 | 49 |
"Image": "ubuntu:latest", |
| 50 | 50 |
"Command": "echo 222222", |
| 51 |
- "Created": "2015-01-05T19:42:44.334772611Z", |
|
| 51 |
+ "Created": 1367854155, |
|
| 52 | 52 |
"Status": "Exit 0", |
| 53 | 53 |
"Ports": [], |
| 54 | 54 |
"SizeRw": 12288, |
| ... | ... |
@@ -58,7 +58,7 @@ List containers |
| 58 | 58 |
"Id": "3176a2479c92", |
| 59 | 59 |
"Image": "ubuntu:latest", |
| 60 | 60 |
"Command": "echo 3333333333333333", |
| 61 |
- "Created": "2014-11-26T20:35:41.514880809Z", |
|
| 61 |
+ "Created": 1367854154, |
|
| 62 | 62 |
"Status": "Exit 0", |
| 63 | 63 |
"Ports":[], |
| 64 | 64 |
"SizeRw":12288, |
| ... | ... |
@@ -68,7 +68,7 @@ List containers |
| 68 | 68 |
"Id": "4cb07b47f9fb", |
| 69 | 69 |
"Image": "ubuntu:latest", |
| 70 | 70 |
"Command": "echo 444444444444444444444444444444444", |
| 71 |
- "Created": "2014-11-26T15:35:05.538305907Z", |
|
| 71 |
+ "Created": 1367854152, |
|
| 72 | 72 |
"Status": "Exit 0", |
| 73 | 73 |
"Ports": [], |
| 74 | 74 |
"SizeRw": 12288, |
| ... | ... |
@@ -1148,7 +1148,7 @@ Status Codes: |
| 1148 | 1148 |
"ubuntu:latest" |
| 1149 | 1149 |
], |
| 1150 | 1150 |
"Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c", |
| 1151 |
- "Created": "2014-11-26T15:35:05.538305907Z", |
|
| 1151 |
+ "Created": 1365714795, |
|
| 1152 | 1152 |
"Size": 131506275, |
| 1153 | 1153 |
"VirtualSize": 131506275 |
| 1154 | 1154 |
}, |
| ... | ... |
@@ -1159,7 +1159,7 @@ Status Codes: |
| 1159 | 1159 |
], |
| 1160 | 1160 |
"ParentId": "27cf784147099545", |
| 1161 | 1161 |
"Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc", |
| 1162 |
- "Created": "2014-11-21T10:18:46.654545839Z", |
|
| 1162 |
+ "Created": 1364102658, |
|
| 1163 | 1163 |
"Size": 24653, |
| 1164 | 1164 |
"VirtualSize": 180116135 |
| 1165 | 1165 |
} |
| ... | ... |
@@ -1176,7 +1176,7 @@ Status Codes: |
| 1176 | 1176 |
|
| 1177 | 1177 |
[ |
| 1178 | 1178 |
{
|
| 1179 |
- "Created": "2015-03-23T15:58:07.610802612Z", |
|
| 1179 |
+ "Created": 1420064636, |
|
| 1180 | 1180 |
"Id": "4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125", |
| 1181 | 1181 |
"ParentId": "ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2", |
| 1182 | 1182 |
"RepoDigests": [ |
| ... | ... |
@@ -1392,12 +1392,12 @@ Return the history of the image `name` |
| 1392 | 1392 |
[ |
| 1393 | 1393 |
{
|
| 1394 | 1394 |
"Id": "b750fe79269d", |
| 1395 |
- "Created": "2014-12-15T19:52:48.480875289Z", |
|
| 1395 |
+ "Created": 1364102658, |
|
| 1396 | 1396 |
"CreatedBy": "/bin/bash" |
| 1397 | 1397 |
}, |
| 1398 | 1398 |
{
|
| 1399 | 1399 |
"Id": "27cf78414709", |
| 1400 |
- "Created": "2013-06-13T21:03:50.821769Z", |
|
| 1400 |
+ "Created": 1364068391, |
|
| 1401 | 1401 |
"CreatedBy": "" |
| 1402 | 1402 |
} |
| 1403 | 1403 |
] |
| ... | ... |
@@ -30,7 +30,7 @@ func (s *TagStore) History(name string) ([]*types.ImageHistory, error) {
|
| 30 | 30 |
err = foundImage.WalkHistory(func(img *image.Image) error {
|
| 31 | 31 |
history = append(history, &types.ImageHistory{
|
| 32 | 32 |
ID: img.ID, |
| 33 |
- Created: img.Created.UTC(), |
|
| 33 |
+ Created: img.Created.Unix(), |
|
| 34 | 34 |
CreatedBy: strings.Join(img.ContainerConfig.Cmd.Slice(), " "), |
| 35 | 35 |
Tags: lookupMap[img.ID], |
| 36 | 36 |
Size: img.Size, |
| ... | ... |
@@ -28,7 +28,7 @@ type ByCreated []*types.Image |
| 28 | 28 |
|
| 29 | 29 |
func (r ByCreated) Len() int { return len(r) }
|
| 30 | 30 |
func (r ByCreated) Swap(i, j int) { r[i], r[j] = r[j], r[i] }
|
| 31 |
-func (r ByCreated) Less(i, j int) bool { return r[i].Created.Before(r[j].Created) }
|
|
| 31 |
+func (r ByCreated) Less(i, j int) bool { return r[i].Created < r[j].Created }
|
|
| 32 | 32 |
|
| 33 | 33 |
func (s *TagStore) Images(config *ImagesConfig) ([]*types.Image, error) {
|
| 34 | 34 |
var ( |
| ... | ... |
@@ -101,7 +101,7 @@ func (s *TagStore) Images(config *ImagesConfig) ([]*types.Image, error) {
|
| 101 | 101 |
newImage := new(types.Image) |
| 102 | 102 |
newImage.ParentId = image.Parent |
| 103 | 103 |
newImage.ID = image.ID |
| 104 |
- newImage.Created = image.Created.UTC() |
|
| 104 |
+ newImage.Created = int(image.Created.Unix()) |
|
| 105 | 105 |
newImage.Size = int(image.Size) |
| 106 | 106 |
newImage.VirtualSize = int(image.GetParentsSize(0) + image.Size) |
| 107 | 107 |
newImage.Labels = image.ContainerConfig.Labels |
| ... | ... |
@@ -138,7 +138,7 @@ func (s *TagStore) Images(config *ImagesConfig) ([]*types.Image, error) {
|
| 138 | 138 |
newImage.RepoTags = []string{"<none>:<none>"}
|
| 139 | 139 |
newImage.RepoDigests = []string{"<none>@<none>"}
|
| 140 | 140 |
newImage.ID = image.ID |
| 141 |
- newImage.Created = image.Created.UTC() |
|
| 141 |
+ newImage.Created = int(image.Created.Unix()) |
|
| 142 | 142 |
newImage.Size = int(image.Size) |
| 143 | 143 |
newImage.VirtualSize = int(image.GetParentsSize(0) + image.Size) |
| 144 | 144 |
newImage.Labels = image.ContainerConfig.Labels |