summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaura Brehm <laurabrehm@hey.com>2023-05-09 16:19:05 +0100
committerLaura Brehm <laurabrehm@hey.com>2023-05-09 16:19:05 +0100
commite8be7921302241b885395322d4a47a57fb2f21cd (patch)
tree6ca0becc7d478cadf8b3726cef5e966d0e647e6c
parent5c052e6c04a5440abd0cde450b831cb93cf2a89c (diff)
downloaddocker-e8be7921302241b885395322d4a47a57fb2f21cd.tar.gz
c8d: fix missing image history
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
-rw-r--r--daemon/containerd/image.go16
-rw-r--r--daemon/containerd/image_commit.go3
2 files changed, 18 insertions, 1 deletions
diff --git a/daemon/containerd/image.go b/daemon/containerd/image.go
index d15369185e..8ced6436f5 100644
--- a/daemon/containerd/image.go
+++ b/daemon/containerd/image.go
@@ -68,6 +68,21 @@ func (i *ImageService) GetImage(ctx context.Context, refOrID string, options ima
exposedPorts[nat.Port(k)] = v
}
+ var imgHistory []image.History
+ for _, h := range ociimage.History {
+ var created time.Time
+ if h.Created != nil {
+ created = *h.Created
+ }
+ imgHistory = append(imgHistory, image.History{
+ Created: created,
+ Author: h.Author,
+ CreatedBy: h.CreatedBy,
+ Comment: h.Comment,
+ EmptyLayer: h.EmptyLayer,
+ })
+ }
+
img := image.NewImage(image.ID(desc.Digest))
img.V1Image = image.V1Image{
ID: string(desc.Digest),
@@ -87,6 +102,7 @@ func (i *ImageService) GetImage(ctx context.Context, refOrID string, options ima
}
img.RootFS = rootfs
+ img.History = imgHistory
if options.Details {
lastUpdated := time.Unix(0, 0)
diff --git a/daemon/containerd/image_commit.go b/daemon/containerd/image_commit.go
index e9dc49d921..bbb4df0ddc 100644
--- a/daemon/containerd/image_commit.go
+++ b/daemon/containerd/image_commit.go
@@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"runtime"
+ "strings"
"time"
"github.com/containerd/containerd/content"
@@ -143,7 +144,7 @@ func generateCommitImageConfig(baseConfig ocispec.Image, diffID digest.Digest, o
},
History: append(baseConfig.History, ocispec.History{
Created: &createdTime,
- CreatedBy: "", // FIXME(ndeloof) ?
+ CreatedBy: strings.Join(opts.ContainerConfig.Cmd, " "),
Author: opts.Author,
Comment: opts.Comment,
EmptyLayer: diffID == "",