# Docker health check powershell cmd high CPU usage Windows Server issue

**URL:** <https://discuss.elastic.co/t/docker-health-check-powershell-cmd-high-cpu-usage-windows-server-issue/192476>\
**Category:** Elasticsearch\
**Created:** [July 26, 2019, 4:14pm UTC](https://discuss.elastic.co/t/docker-health-check-powershell-cmd-high-cpu-usage-windows-server-issue/192476 "2019-07-26T16:14:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aidar\_Gatin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aidar_gatin/32/49388_2.png) [@Aidar\_Gatin](https://discuss.elastic.co/u/Aidar_Gatin)\
**Post date:** [July 26, 2019, 4:14pm UTC](https://discuss.elastic.co/t/docker-health-check-powershell-cmd-high-cpu-usage-windows-server-issue/192476/1 "2019-07-26T16:14:43Z")

</div>

Hi,

Maybe this is more Docker related question, but maybe someone can suggest something.

I use Windows Server 2016  
Hosting ES 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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 23, 2019, 4:14pm UTC](https://discuss.elastic.co/t/docker-health-check-powershell-cmd-high-cpu-usage-windows-server-issue/192476/2 "2019-08-23T16:14:43Z")

</div>

Closed on August 23, 2019, 4:14pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
