1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-08 02:20:13 +00:00

Fix panic in container running check

This commit is contained in:
moelsayed
2019-02-27 23:44:13 +02:00
committed by Alena Prokharchyk
parent eb6116dded
commit bc5c061527

View File

@@ -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
}
}