Skip to content

Commit 17420ed

Browse files
committed
[es] Added HEALTHCHECK
1 parent 2125fa0 commit 17420ed

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

elasticsearch/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ RUN cd /usr/share && \
1313

1414
EXPOSE 9200 9300
1515

16+
HEALTHCHECK --timeout=5s CMD wget -q -O - http://$HOSTNAME:9200/_cat/health
17+
1618
ENV ES_HOME=/usr/share/elasticsearch-$ES_VERSION \
1719
DEFAULT_ES_USER=elasticsearch \
1820
ES_JAVA_OPTS="-Xms1g -Xmx1g"

elasticsearch/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,22 @@ tdvfilj370yn es_master replicated 1/1 es
7272

7373
As you can see, there is also a Kibana instance included and available at port 5601.
7474

75+
# Health Checks
76+
77+
This container declares a [HEALTHCHECK](https://docs.docker.com/engine/reference/builder/#/healthcheck) that queries the `_cat/health`
78+
endpoint for a quick, one-line gauge of health every 30 seconds.
79+
80+
The current health of the container is shown in the `STATUS` column of `docker ps`, such as
81+
82+
Up 14 minutes (healthy)
83+
84+
You can also check the history of health checks from `inspect`, such as:
85+
86+
```
87+
> docker inspect -f "{{json .State.Health}}" es
88+
{"Status":"healthy","FailingStreak":0,"Log":[...
89+
```
90+
7591
# Configuration Summary
7692

7793
## Ports

0 commit comments

Comments
 (0)