mirror of
https://github.com/containers/podman.git
synced 2025-06-21 01:19:15 +08:00
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
This commit is contained in:

committed by
Atomic Bot

parent
1fb8d7f248
commit
c3a0874222
@ -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 {
|
||||
|
Reference in New Issue
Block a user