Docker Community Forums

Share and learn in the Docker community.

Which not found : While creating Elastic search Docker image


(Telednacomm) #1

I am running this Docker file which is throwing an error of
Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME /usr/src/elastic/elasticsearch-2.3.4/bin/elasticsearch: line 103: which: command not found

Here is my Dockerfile

FROM centos:7
# Install dependencies RUN \ mkdir -p /opt/ && \ curl -v -j -k -L -H "Cookie: oraclelicense=accept-securebackup-cookie" > jdk-8u92-linux-x64.tar.gz && \ tar -zxvf jdk-8u92-linux-x64.tar.gz && \ cd /usr/bin/ && \ ln -s /opt/jdk-8u92-linux-x64/bin/java java && \ mkdir -p /usr/src/elastic RUN useradd -ms /bin/bash elas USER elas RUN \ cd /usr/src/elastic && \ curl -L -O && \ tar -zxvf elasticsearch-2.3.4.tar.gz && \ cd - COPY elasticsearch.yml /usr/src/elastic/elasticsearch-2.3.4/config/ ENV JAVA_HOME /opt/jdk-8u92-linux-x64/ RUN \ cd /usr/src/elastic/elasticsearch-2.3.4 && \ export JAVACMD="/usr/bin/java" ENV PATH=$PATH:/usr/src/elastic/elasticsearch-2.3.4/bin ENV PATH=$PATH:/usr/bin EXPOSE 9200 9300 CMD ["elasticsearch"]