Docker Community Forums

Share and learn in the Docker community.

Docker health check powershell cmd high CPU usage Windows Server issue


I use Windows Server 2016
Hosting Elastic Search version 7.1.1 in Docker container microsoft/windowsservercore- ltsc2016

I’ve built an image with the health check command

HEALTHCHECK --interval=5s
CMD powershell -command
try { $content = (iwr -useb http://localhost:9205/_cat/health).Content;
$health = $content.Split(’ ')[3]; if ($health -eq 'green' -or $health -eq 'yellow') { return 0 }
else { return 1 }; `
} catch { return 1 }

Now every 5 seconds, Powershell script executes and takes 50% CPU.
If I run 2 containers with ES and one with Kibana, CPU usage is 100%

Could you suggest another health check approach in this case?

Known issue.

Thanks for reply, but I need JDK running in container to host elastic search engine.
I have to use microsoft/windowsservercore- ltsc2016 image