summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2021-02-15 09:32:49 -0600
committerbaude <bbaude@redhat.com>2021-02-16 06:29:49 -0600
commitf2f18768a8c705a0a15abe814aaa52640af0b279 (patch)
treed75c9f94d5789999e1227438ae1df4fecfe147c7 /libpod
parent8c444e6f0b3663a657c946e1c731f390553f065d (diff)
downloadpodman-f2f18768a8c705a0a15abe814aaa52640af0b279.tar.gz
podman-f2f18768a8c705a0a15abe814aaa52640af0b279.tar.bz2
podman-f2f18768a8c705a0a15abe814aaa52640af0b279.zip
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>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/runtime_pod_infra_linux.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/libpod/runtime_pod_infra_linux.go b/libpod/runtime_pod_infra_linux.go
index bc37bdb23..c6f268182 100644
--- a/libpod/runtime_pod_infra_linux.go
+++ b/libpod/runtime_pod_infra_linux.go
@@ -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)