From bc5c06152748ce3f36dc4cd6e9c46d0c64c14561 Mon Sep 17 00:00:00 2001 From: moelsayed Date: Wed, 27 Feb 2019 23:44:13 +0200 Subject: [PATCH] Fix panic in container running check --- docker/docker.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/docker.go b/docker/docker.go index 53bef8dc..50844354 100644 --- a/docker/docker.go +++ b/docker/docker.go @@ -20,7 +20,7 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/pkg/stdcopy" "github.com/rancher/rke/log" - "github.com/rancher/types/apis/management.cattle.io/v3" + v3 "github.com/rancher/types/apis/management.cattle.io/v3" "github.com/sirupsen/logrus" "k8s.io/apimachinery/pkg/util/sets" ) @@ -170,7 +170,7 @@ func IsContainerRunning(ctx context.Context, dClient *client.Client, hostname st } for _, container := range containers { - if container.Names[0] == "/"+containerName { + if len(container.Names) != 0 && container.Names[0] == "/"+containerName { return true, nil } }