diff options
author | baude <bbaude@redhat.com> | 2019-01-15 10:27:13 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2019-01-15 10:29:24 -0600 |
commit | 9a23e285d3ef7d356cb08cd431bcc6ffc7b579ab (patch) | |
tree | e4e1be5f91b0c3fcec243a8b1da77c41d2216b38 /libpod/adapter | |
parent | 077156d45cfea915cc249e92a5a45280e5ed71e1 (diff) | |
download | podman-9a23e285d3ef7d356cb08cd431bcc6ffc7b579ab.tar.gz podman-9a23e285d3ef7d356cb08cd431bcc6ffc7b579ab.tar.bz2 podman-9a23e285d3ef7d356cb08cd431bcc6ffc7b579ab.zip |
add support for podman-remote history
this adds support to get the history for an image and its
layers using podman-remote.
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'libpod/adapter')
-rw-r--r-- | libpod/adapter/runtime_remote.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libpod/adapter/runtime_remote.go b/libpod/adapter/runtime_remote.go index bb00350e0..5413385d2 100644 --- a/libpod/adapter/runtime_remote.go +++ b/libpod/adapter/runtime_remote.go @@ -221,3 +221,28 @@ func (r RemoteRuntime) RemoveImage(force bool) error { func (r *LocalRuntime) RemoveImage(ctx context.Context, img *ContainerImage, force bool) (string, error) { return iopodman.RemoveImage().Call(r.Conn, img.InputName, force) } + +// History returns the history of an image and its layers +func (ci *ContainerImage) History(ctx context.Context) ([]*image.History, error) { + var imageHistories []*image.History + + reply, err := iopodman.HistoryImage().Call(ci.Runtime.Conn, ci.InputName) + if err != nil { + return nil, err + } + for _, h := range reply { + created, err := splitStringDate(h.Created) + if err != nil { + return nil, err + } + ih := image.History{ + ID: h.Id, + Created: &created, + CreatedBy: h.CreatedBy, + Size: h.Size, + Comment: h.Comment, + } + imageHistories = append(imageHistories, &ih) + } + return imageHistories, nil +} |