diff --git a/elasticsearch/Dockerfile b/elasticsearch/Dockerfile index 07f1da1d..936b9fc3 100755 --- a/elasticsearch/Dockerfile +++ b/elasticsearch/Dockerfile @@ -13,6 +13,8 @@ RUN cd /usr/share && \ EXPOSE 9200 9300 +HEALTHCHECK --timeout=5s CMD wget -q -O - http://$HOSTNAME:9200/_cat/health + ENV ES_HOME=/usr/share/elasticsearch-$ES_VERSION \ DEFAULT_ES_USER=elasticsearch \ ES_JAVA_OPTS="-Xms1g -Xmx1g" diff --git a/elasticsearch/README.md b/elasticsearch/README.md index 47a722dc..b6aad769 100755 --- a/elasticsearch/README.md +++ b/elasticsearch/README.md @@ -72,6 +72,22 @@ tdvfilj370yn es_master replicated 1/1 es As you can see, there is also a Kibana instance included and available at port 5601. +# Health Checks + +This container declares a [HEALTHCHECK](https://docs.docker.com/engine/reference/builder/#/healthcheck) that queries the `_cat/health` +endpoint for a quick, one-line gauge of health every 30 seconds. + +The current health of the container is shown in the `STATUS` column of `docker ps`, such as + + Up 14 minutes (healthy) + +You can also check the history of health checks from `inspect`, such as: + +``` +> docker inspect -f "{{json .State.Health}}" es +{"Status":"healthy","FailingStreak":0,"Log":[... +``` + # Configuration Summary ## Ports