From 97fec292123939d2cb505c26c327726163ff1867 Mon Sep 17 00:00:00 2001 From: zhangguanzhang Date: Fri, 16 Oct 2020 11:05:44 +0800 Subject: Fix panic when runlabel is missing Signed-off-by: zhangguanzhang --- pkg/domain/infra/abi/containers_runlabel.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pkg') diff --git a/pkg/domain/infra/abi/containers_runlabel.go b/pkg/domain/infra/abi/containers_runlabel.go index 30a5a55b8..41fdf8f34 100644 --- a/pkg/domain/infra/abi/containers_runlabel.go +++ b/pkg/domain/infra/abi/containers_runlabel.go @@ -28,6 +28,9 @@ func (ic *ContainerEngine) ContainerRunlabel(ctx context.Context, label string, if err != nil { return err } + if runlabel == "" { + return errors.Errorf("cannot find the value of label: %s in image: %s", label, imageRef) + } cmd, env, err := generateRunlabelCommand(runlabel, img, args, options) if err != nil { -- cgit v1.2.3-54-g00ecf