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:
committed by
Alena Prokharchyk
parent
eb6116dded
commit
bc5c061527
@@ -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
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user