diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-04-20 17:19:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-20 17:19:32 -0400 |
commit | b7714672247e2674303c46fa93b12cbf047b0204 (patch) | |
tree | c4615354a29a9d0cf744c3c833e0878e4fe04dfb /libpod | |
parent | 1e9b3e7500a14ae066f5790fad6c3dfa9f94b688 (diff) | |
parent | b35a0d0cd2bad55e7d1a7c8d77322d2ff3f43600 (diff) | |
download | podman-b7714672247e2674303c46fa93b12cbf047b0204.tar.gz podman-b7714672247e2674303c46fa93b12cbf047b0204.tar.bz2 podman-b7714672247e2674303c46fa93b12cbf047b0204.zip |
Merge pull request #5862 from rhatdan/v2
Fix up handling of image data as well as setting Linux Capabilties correctly
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/image/image.go | 61 |
1 files changed, 58 insertions, 3 deletions
diff --git a/libpod/image/image.go b/libpod/image/image.go index 7198a42a3..bbf803056 100644 --- a/libpod/image/image.go +++ b/libpod/image/image.go @@ -867,22 +867,77 @@ func (i *Image) Intermediate(ctx context.Context) (bool, error) { return false, nil } +// User returns the image's user +func (i *Image) User(ctx context.Context) (string, error) { + imgInspect, err := i.inspect(ctx, false) + if err != nil { + return "", err + } + return imgInspect.Config.User, nil +} + +// StopSignal returns the image's StopSignal +func (i *Image) StopSignal(ctx context.Context) (string, error) { + imgInspect, err := i.inspect(ctx, false) + if err != nil { + return "", err + } + return imgInspect.Config.StopSignal, nil +} + +// WorkingDir returns the image's WorkingDir +func (i *Image) WorkingDir(ctx context.Context) (string, error) { + imgInspect, err := i.inspect(ctx, false) + if err != nil { + return "", err + } + return imgInspect.Config.WorkingDir, nil +} + +// Cmd returns the image's cmd +func (i *Image) Cmd(ctx context.Context) ([]string, error) { + imgInspect, err := i.inspect(ctx, false) + if err != nil { + return nil, err + } + return imgInspect.Config.Cmd, nil +} + +// Entrypoint returns the image's entrypoint +func (i *Image) Entrypoint(ctx context.Context) ([]string, error) { + imgInspect, err := i.inspect(ctx, false) + if err != nil { + return nil, err + } + return imgInspect.Config.Entrypoint, nil +} + +// Env returns the image's env +func (i *Image) Env(ctx context.Context) ([]string, error) { + imgInspect, err := i.imageInspectInfo(ctx) + if err != nil { + return nil, err + } + return imgInspect.Env, nil +} + // Labels returns the image's labels func (i *Image) Labels(ctx context.Context) (map[string]string, error) { imgInspect, err := i.imageInspectInfo(ctx) if err != nil { - return nil, nil + return nil, err } return imgInspect.Labels, nil } // GetLabel Returns a case-insensitive match of a given label func (i *Image) GetLabel(ctx context.Context, label string) (string, error) { - imageLabels, err := i.Labels(ctx) + labels, err := i.Labels(ctx) if err != nil { return "", err } - for k, v := range imageLabels { + + for k, v := range labels { if strings.ToLower(k) == strings.ToLower(label) { return v, nil } |