summaryrefslogtreecommitdiff
path: root/pkg/adapter/images.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-04-04 13:00:25 -0700
committerGitHub <noreply@github.com>2019-04-04 13:00:25 -0700
commitbf3593ef8d57b2b6e187a5c1cccf7cb9770182ec (patch)
tree405377d36b50c6afdc9d829beffe7868f4641025 /pkg/adapter/images.go
parente320efe9ed158f48eefa7046d88f5c842e454f61 (diff)
parentdc94dbd3c17c9011fc1e851694a2190dcf6c2b3c (diff)
downloadpodman-bf3593ef8d57b2b6e187a5c1cccf7cb9770182ec.tar.gz
podman-bf3593ef8d57b2b6e187a5c1cccf7cb9770182ec.tar.bz2
podman-bf3593ef8d57b2b6e187a5c1cccf7cb9770182ec.zip
Merge pull request #2831 from baude/remotetree
podman-remote image tree
Diffstat (limited to 'pkg/adapter/images.go')
-rw-r--r--pkg/adapter/images.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/pkg/adapter/images.go b/pkg/adapter/images.go
new file mode 100644
index 000000000..c8ea1cdea
--- /dev/null
+++ b/pkg/adapter/images.go
@@ -0,0 +1,34 @@
+// +build !remoteclient
+
+package adapter
+
+import (
+ "github.com/containers/libpod/cmd/podman/cliconfig"
+ "github.com/containers/libpod/libpod/image"
+ "github.com/pkg/errors"
+)
+
+// Tree ...
+func (r *LocalRuntime) Tree(c *cliconfig.TreeValues) (*image.InfoImage, map[string]*image.LayerInfo, *ContainerImage, error) {
+ img, err := r.NewImageFromLocal(c.InputArgs[0])
+ if err != nil {
+ return nil, nil, nil, err
+ }
+
+ // Fetch map of image-layers, which is used for printing output.
+ layerInfoMap, err := image.GetLayersMapWithImageInfo(r.Runtime.ImageRuntime())
+ if err != nil {
+ return nil, nil, nil, errors.Wrapf(err, "error while retrieving layers of image %q", img.InputName)
+ }
+
+ // Create an imageInfo and fill the image and layer info
+ imageInfo := &image.InfoImage{
+ ID: img.ID(),
+ Tags: img.Names(),
+ }
+
+ if err := image.BuildImageHierarchyMap(imageInfo, layerInfoMap, img.TopLayer()); err != nil {
+ return nil, nil, nil, err
+ }
+ return imageInfo, layerInfoMap, img, nil
+}