Potentially fixes #1
This commit is contained in:
parent
6af8cb3e1b
commit
8426640271
1 changed files with 8 additions and 7 deletions
|
@ -111,15 +111,16 @@ function getStatus(containers: Dockerode.ContainerInfo[], entry: Service) {
|
|||
else if (entry.type === "docker") {
|
||||
entry.status = ServiceStatus.offline;
|
||||
// Loop over every found container and compare to the entry provided
|
||||
containers.forEach((element: Dockerode.ContainerInfo) => {
|
||||
element.Names.forEach((containerName: string) => {
|
||||
if (containerName.startsWith("/")) {
|
||||
containerName = containerName.substring(1);
|
||||
}
|
||||
if (containerName === entry.docker_container_name) {
|
||||
containers.forEach((container: Dockerode.ContainerInfo) => {
|
||||
console.log(container)
|
||||
if (container.Names.includes("/" + entry.docker_container_name) || container.Names.includes(entry.docker_container_name)) {
|
||||
if (container.State === "running") {
|
||||
entry.status = ServiceStatus.online;
|
||||
}
|
||||
});
|
||||
else {
|
||||
entry.status = ServiceStatus.offline;
|
||||
}
|
||||
}
|
||||
if (entry.docker_container_name == null) {
|
||||
console.log("MISSING DOCKER CONTAINER NAME FOR " + entry.name);
|
||||
entry.status = ServiceStatus.error;
|
||||
|
|
Loading…
Reference in a new issue