FROM java:8 ENV ELASTICSEARCH=2.4.6 # elasticsearch doesn't allow to run as root RUN useradd user RUN mkdir -p /data/esdata RUN mkdir -p /data/log RUN chown -R user:user /data WORKDIR /usr/src COPY elasticsearch-${ELASTICSEARCH} /usr/src/ COPY docker-entrypoint.sh /docker-entrypoint.sh EXPOSE 9200 EXPOSE 9300 USER user:user # RUN /usr/src/elasticsearch-2.4.6/bin/elasticsearch CMD ["/docker-entrypoint.sh"]