Based on imocence/openjre-alpine:v11.0.16 mirror build ES
485
# Base image
FROM imocence/openjre-alpine:v11.0.16
# Image creator
MAINTAINER imocence
ENV ES_VER=7.8.0 ELASTIC_HOME=/home/elastic SER_UID=777
ADD elasticsearch-oss-$ES_VER-no-jdk-linux-x86_64.tar.gz $ELASTIC_HOME
ENV PATH=$ELASTIC_HOME/elasticsearch:$PATH
RUN apk add -U nodejs && rm -rf /var/cache/apk/* && addgroup -g $SER_UID elastic \
&& adduser -u $SER_UID -G elastic -h $ELASTIC_HOME -s /sbin/nologin -D elastic \
&& mv $ELASTIC_HOME/elasticsearch-$ES_VER $ELASTIC_HOME/elasticsearch \
&& mv $ELASTIC_HOME/elasticsearch/config $ELASTIC_HOME/elasticsearch/es_conf \
&& mkdir /es_data /es_logs /es_conf \
&& rm -rf $ELASTIC_HOME/elasticsearch/data \
&& rm -rf $ELASTIC_HOME/elasticsearch/logs \
&& ln -s /es_data $ELASTIC_HOME/elasticsearch/data \
&& ln -s /es_logs $ELASTIC_HOME/elasticsearch/logs \
&& ln -s /es_conf $ELASTIC_HOME/elasticsearch/config \
&& chown -R elastic:elastic $ELASTIC_HOME/ /es_data /es_logs /es_conf
WORKDIR $ELASTIC_HOME
EXPOSE 9200 9300
USER elastic
VOLUME ["/es_data","/es_logs","/es_conf"]
CMD if [ ! -f "/es_conf/log4j2.properties" ];then cp $ELASTIC_HOME/elasticsearch/es_conf/* /es_conf; fi \
&& java -Xshare:auto -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -Dfile.encoding=UTF-8 \
-Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Des.path.home="$ELASTIC_HOME/elasticsearch" -Xms4g -Xmx4g -Des.path.conf="/es_conf" \
-cp "$ELASTIC_HOME/elasticsearch/lib/*:$ELASTIC_HOME/elasticsearch/config" org.elasticsearch.bootstrap.Elasticsearch -d
# Base image
FROM imocence/openjre-alpine:v11.0.16
# Image creator
MAINTAINER imocence
ENV ES_VER=7.8.0 ELASTIC_HOME=/home/elastic SER_UID=777
ADD elasticsearch-oss-$ES_VER-no-jdk-linux-x86_64.tar.gz $ELASTIC_HOME
COPY elastic-entrypoint.sh $ELASTIC_HOME
RUN apk add -U bash && rm -rf /tmp/* /var/cache/apk/* && addgroup -g $SER_UID elastic \
&& adduser -u $SER_UID -G elastic -h $ELASTIC_HOME -s /sbin/nologin -D elastic \
&& mv $ELASTIC_HOME/elasticsearch-$ES_VER $ELASTIC_HOME/elasticsearch \
&& mv $ELASTIC_HOME/elasticsearch/config $ELASTIC_HOME/elasticsearch/es_conf \
&& for path in "/es_data" "/es_logs" "/es_conf" "/es_plugins";do mkdir "$path" \
&& chown -R elastic:elastic "$path"; done \
&& rm -rf $ELASTIC_HOME/elasticsearch/data \
&& rm -rf $ELASTIC_HOME/elasticsearch/logs \
&& rm -rf $ELASTIC_HOME/elasticsearch/plugins \
&& ln -s /es_data $ELASTIC_HOME/elasticsearch/data \
&& ln -s /es_logs $ELASTIC_HOME/elasticsearch/logs \
&& ln -s /es_conf $ELASTIC_HOME/elasticsearch/config \
&& ln -s /es_plugins $ELASTIC_HOME/elasticsearch/plugins \
&& ln -s $JAVA_HOME $ELASTIC_HOME/elasticsearch/jdk \
&& sed -i 's#-x "$JAVA"#-f "$JAVA"#' $ELASTIC_HOME/elasticsearch/bin/elasticsearch-env \
&& chown -R elastic:elastic $ELASTIC_HOME/* && chmod 777 $ELASTIC_HOME/elastic-entrypoint.sh
USER elastic
ENV PATH $ELASTIC_HOME/elasticsearch/bin:$PATH
WORKDIR $ELASTIC_HOME
EXPOSE 9200 9300
VOLUME ["/es_data","/es_logs","/es_conf","/es_plugins"]
ENTRYPOINT ["/home/elastic/elastic-entrypoint.sh"]
CMD ["elasticsearch"]
version: '2'
services:
web:
image: imocence/elasticsearch-alpine:v7.8.0
container_name: elastic
ports:
- "0.0.0.0:9200:9200"
volumes:
- ./es_data:/es_data
- ./es_logs:/es_logs
- ./es_conf:/es_conf
restart: unless-stopped
Note: to create mapping files in the directory and give read and write permissions
Content type
Image
Digest
sha256:cb3f3af63…
Size
126.6 MB
Last updated
almost 3 years ago
docker pull imocence/elasticsearch-alpine