aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-09-18 09:00:22 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-09-18 13:29:20 +0000
commitc3a0874222784e8996dbc472b9ca893a80aff451 (patch)
tree6bc46ffa4c4cd1961a4c2ddebac245cd3da9faf9
parent1fb8d7f248f9678ca9d5d39232ef3df23ab226d6 (diff)
downloadpodman-c3a0874222784e8996dbc472b9ca893a80aff451.tar.gz
podman-c3a0874222784e8996dbc472b9ca893a80aff451.tar.bz2
podman-c3a0874222784e8996dbc472b9ca893a80aff451.zip
Don't crash if an image has no names
When image is not tagged, we should just set the imageName to the image.ID. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #1501 Approved by: mheon
-rw-r--r--cmd/podman/create.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/podman/create.go b/cmd/podman/create.go
index ae6713cb4..ce62bd278 100644
--- a/cmd/podman/create.go
+++ b/cmd/podman/create.go
@@ -123,7 +123,12 @@ func createContainer(c *cli.Context, runtime *libpod.Runtime) (*libpod.Container
return nil, nil, err
}
data, err = newImage.Inspect(ctx)
- imageName = newImage.Names()[0]
+ names := newImage.Names()
+ if len(names) > 0 {
+ imageName = names[0]
+ } else {
+ imageName = newImage.ID()
+ }
}
createConfig, err := parseCreateOpts(ctx, c, runtime, imageName, data)
if err != nil {