Fix panic in pod creation

when creating a pod with --infra-image and using a untagged image for
the infra-image (none/none), the lookup for the image's name was
creating a panic.

Fixes: #9374

Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
baude
2021-02-15 09:32:49 -06:00
parent 8c444e6f0b
commit f2f18768a8
3 changed files with 27 additions and 3 deletions

View File

@ -225,7 +225,10 @@ func (r *Runtime) createInfraContainer(ctx context.Context, p *Pod) (*Container,
if err != nil {
return nil, err
}
imageName := newImage.Names()[0]
imageName := "none"
if len(newImage.Names()) > 0 {
imageName = newImage.Names()[0]
}
imageID := data.ID
return r.makeInfraContainer(ctx, p, imageName, r.config.Engine.InfraImage, imageID, data.Config)