diff --git a/images/elasticsearch/5.2/Dockerfile b/images/elasticsearch/5.2/Dockerfile index e513f24f..4353ae18 100644 --- a/images/elasticsearch/5.2/Dockerfile +++ b/images/elasticsearch/5.2/Dockerfile @@ -1,12 +1,16 @@ -FROM docker.elastic.co/elasticsearch/elasticsearch:5.2.2 +FROM elasticsearch:5.2.2 -RUN echo "xpack.security.enabled: false" >> /usr/share/elasticsearch/config/elasticsearch.yml +RUN apt update || true \ + && apt install zip +RUN zip -q -d /usr/share/elasticsearch/lib/log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class RUN bin/elasticsearch-plugin install analysis-icu && \ bin/elasticsearch-plugin install analysis-phonetic ADD docker-healthcheck.sh /docker-healthcheck.sh +ADD docker-entrypoint.sh /docker-entrypoint.sh + HEALTHCHECK --retries=3 CMD ["bash", "/docker-healthcheck.sh"] EXPOSE 9200 9300 diff --git a/images/elasticsearch/5.2/docker-entrypoint.sh b/images/elasticsearch/5.2/docker-entrypoint.sh new file mode 100755 index 00000000..19fce400 --- /dev/null +++ b/images/elasticsearch/5.2/docker-entrypoint.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +set -e + +# Add elasticsearch as command if needed +if [ "${1:0:1}" = '-' ]; then + set -- elasticsearch "$@" +fi + +# Drop root privileges if we are running elasticsearch +# allow the container to be started with `--user` +if [ "$1" = 'elasticsearch' -a "$(id -u)" = '0' ]; then + # Change the ownership of user-mutable directories to elasticsearch + for path in \ + /usr/share/elasticsearch/data \ + /usr/share/elasticsearch/logs \ + ; do + chown -R elasticsearch:elasticsearch "$path" + done + + es_opts='' + + while IFS='=' read -r envvar_key envvar_value + do + # Elasticsearch env vars need to have at least two dot separated lowercase words, e.g. `cluster.name` + if [[ "$envvar_key" =~ ^[a-z]+\.[a-z]+ ]] + then + if [[ ! -z $envvar_value ]]; then + es_opt="-E${envvar_key}=${envvar_value}" + es_opts+=" ${es_opt}" + fi + fi + done < <(env) + + set -- gosu elasticsearch "$@" ${es_opts} + #exec gosu elasticsearch "$BASH_SOURCE" "$@" +fi + +# As argument is not related to elasticsearch, +# then assume that user wants to run his own process, +# for example a `bash` shell to explore this image +exec "$@" diff --git a/images/elasticsearch/6.5/Dockerfile b/images/elasticsearch/6.5/Dockerfile index cc2ec054..5b7c0a7a 100644 --- a/images/elasticsearch/6.5/Dockerfile +++ b/images/elasticsearch/6.5/Dockerfile @@ -1,5 +1,8 @@ FROM docker.elastic.co/elasticsearch/elasticsearch:6.5.4 +RUN yum -y install zip +RUN zip -q -d /usr/share/elasticsearch/lib/log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class + RUN echo "xpack.security.enabled: false" >> /usr/share/elasticsearch/config/elasticsearch.yml RUN bin/elasticsearch-plugin install -b analysis-icu && \ diff --git a/images/elasticsearch/6.8/Dockerfile b/images/elasticsearch/6.8/Dockerfile index 24818946..aa131c97 100644 --- a/images/elasticsearch/6.8/Dockerfile +++ b/images/elasticsearch/6.8/Dockerfile @@ -1,5 +1,8 @@ FROM docker.elastic.co/elasticsearch/elasticsearch:6.8.15 +RUN yum -y install zip +RUN zip -q -d /usr/share/elasticsearch/lib/log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class + RUN echo "xpack.security.enabled: false" >> /usr/share/elasticsearch/config/elasticsearch.yml RUN echo "discovery.type: single-node" >> /usr/share/elasticsearch/config/elasticsearch.yml RUN bin/elasticsearch-plugin install -b analysis-icu && \ diff --git a/images/elasticsearch/7.11/Dockerfile b/images/elasticsearch/7.11/Dockerfile index fced5aaa..a25c50c2 100644 --- a/images/elasticsearch/7.11/Dockerfile +++ b/images/elasticsearch/7.11/Dockerfile @@ -1,5 +1,8 @@ FROM docker.elastic.co/elasticsearch/elasticsearch:7.11.2 +RUN yum -y install zip +RUN zip -q -d /usr/share/elasticsearch/lib/log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class + RUN echo "xpack.security.enabled: false" >> /usr/share/elasticsearch/config/elasticsearch.yml RUN echo "discovery.type: single-node" >> /usr/share/elasticsearch/config/elasticsearch.yml RUN bin/elasticsearch-plugin install -b analysis-icu && \ diff --git a/images/elasticsearch/7.5/Dockerfile b/images/elasticsearch/7.5/Dockerfile index e80fa5fd..8717d31e 100644 --- a/images/elasticsearch/7.5/Dockerfile +++ b/images/elasticsearch/7.5/Dockerfile @@ -1,5 +1,8 @@ FROM docker.elastic.co/elasticsearch/elasticsearch:7.5.2 +RUN yum -y install zip +RUN zip -q -d /usr/share/elasticsearch/lib/log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class + RUN echo "xpack.security.enabled: false" >> /usr/share/elasticsearch/config/elasticsearch.yml RUN echo "discovery.type: single-node" >> /usr/share/elasticsearch/config/elasticsearch.yml RUN bin/elasticsearch-plugin install -b analysis-icu && \ diff --git a/images/elasticsearch/7.6/Dockerfile b/images/elasticsearch/7.6/Dockerfile index b995359a..3e2ab137 100644 --- a/images/elasticsearch/7.6/Dockerfile +++ b/images/elasticsearch/7.6/Dockerfile @@ -1,5 +1,8 @@ FROM docker.elastic.co/elasticsearch/elasticsearch:7.6.2 +RUN yum -y install zip +RUN zip -q -d /usr/share/elasticsearch/lib/log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class + RUN echo "xpack.security.enabled: false" >> /usr/share/elasticsearch/config/elasticsearch.yml RUN echo "discovery.type: single-node" >> /usr/share/elasticsearch/config/elasticsearch.yml RUN bin/elasticsearch-plugin install -b analysis-icu && \ diff --git a/images/elasticsearch/7.7/Dockerfile b/images/elasticsearch/7.7/Dockerfile index c7764b51..8f41ffcd 100644 --- a/images/elasticsearch/7.7/Dockerfile +++ b/images/elasticsearch/7.7/Dockerfile @@ -1,5 +1,8 @@ FROM docker.elastic.co/elasticsearch/elasticsearch:7.7.1 +RUN yum -y install zip +RUN zip -q -d /usr/share/elasticsearch/lib/log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class + RUN echo "xpack.security.enabled: false" >> /usr/share/elasticsearch/config/elasticsearch.yml RUN echo "discovery.type: single-node" >> /usr/share/elasticsearch/config/elasticsearch.yml RUN bin/elasticsearch-plugin install -b analysis-icu && \ diff --git a/images/elasticsearch/7.9/Dockerfile b/images/elasticsearch/7.9/Dockerfile index ee279cf4..8b531a87 100644 --- a/images/elasticsearch/7.9/Dockerfile +++ b/images/elasticsearch/7.9/Dockerfile @@ -1,5 +1,8 @@ FROM docker.elastic.co/elasticsearch/elasticsearch:7.9.3 +RUN yum -y install zip +RUN zip -q -d /usr/share/elasticsearch/lib/log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class + RUN echo "xpack.security.enabled: false" >> /usr/share/elasticsearch/config/elasticsearch.yml RUN echo "discovery.type: single-node" >> /usr/share/elasticsearch/config/elasticsearch.yml RUN bin/elasticsearch-plugin install -b analysis-icu && \ diff --git a/images/elasticsearch/es/Dockerfile b/images/elasticsearch/es/Dockerfile index 3a2d34ec..3bdd5de1 100755 --- a/images/elasticsearch/es/Dockerfile +++ b/images/elasticsearch/es/Dockerfile @@ -1,5 +1,8 @@ FROM docker.elastic.co/elasticsearch/elasticsearch:{%version%} +RUN yum -y install zip +RUN zip -q -d /usr/share/elasticsearch/lib/log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class + RUN echo "xpack.security.enabled: false" >> /usr/share/elasticsearch/config/elasticsearch.yml {%single_node%} RUN bin/elasticsearch-plugin install -b analysis-icu && \