# Docker-compose setup healthcheck unhealthy

**URL:** <https://discuss.elastic.co/t/docker-compose-setup-healthcheck-unhealthy/321665>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [December 20, 2022, 2:50pm UTC](https://discuss.elastic.co/t/docker-compose-setup-healthcheck-unhealthy/321665 "2022-12-20T14:50:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![divadpoc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divadpoc/32/97844_2.png) [@divadpoc](https://discuss.elastic.co/u/divadpoc)\
**Post date:** [December 20, 2022, 2:50pm UTC](https://discuss.elastic.co/t/docker-compose-setup-healthcheck-unhealthy/321665/1 "2022-12-20T14:50:51Z")

</div>

Hello,

I'm using the example `docker-compose` file as presented [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-file) - with stack version `8.5.2` . I wrapped the docker-compose command into a systemd script. All services were running until today when I had to restart my machine, and it didn't come back up again.

It says `container for service "setup" is unhealthy` .

when invoking `docker-compose` w/o the `-d` flag, i see:

```auto
Waiting for Elasticsearch availability
Setting kibana_system password
All done!
setup-1 exited with code 0
container for service "setup" is unhealthy

```

I then changed the following lines:

```auto
    healthcheck:
      #test: ["CMD-SHELL", "[-f config/certs/es01/es01.crt]"]
      test: ["CMD-SHELL", "[-d config/certs/es01/]"]

```

and health check was fine. On my next service restart it did fail again, so I changed back to:

```auto
    healthcheck:
      test: ["CMD-SHELL", "[-f config/certs/es01/es01.crt]"]
      #test: ["CMD-SHELL", "[-d config/certs/es01/]"]

```

and the check again passed.

Do you have any idea why I have to change the `check` command in between restarts ?

---

<div class="post-metadata">

**Author:** ![divadpoc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divadpoc/32/97844_2.png) [@divadpoc](https://discuss.elastic.co/u/divadpoc)\
**Post date:** [January 9, 2023, 10:36am UTC](https://discuss.elastic.co/t/docker-compose-setup-healthcheck-unhealthy/321665/2 "2023-01-09T10:36:39Z")

</div>

any ideas why the health check fails on service restarts?

---

<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:** [February 6, 2023, 10:37am UTC](https://discuss.elastic.co/t/docker-compose-setup-healthcheck-unhealthy/321665/3 "2023-02-06T10:37:02Z")

</div>

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