I'm making a dockerfile to install elasticsearch:6.5.4 and add few files to required locations and run a script named test.sh to create a new index in elasticsearch while elasticsearch is running.
I'm not sure whether i should use RUN, CMD or ENTRYPOINT to do that.
I've successfully built an image and run a container by commenting my last line (containing RUN/CMD/ENTRYPOINT test.sh). I was able to run the test.sh from bash of container and get the desired result.
but when i try to build an image for same process, i get the following error:
$ docker build -t es .
Sending build context to Docker daemon 7.499MB
Step 1/8 : FROM elasticsearch:6.5.4
---> 93109ce1d590
Step 2/8 : WORKDIR /app
---> Running in 6b6412093d53
Removing intermediate container 6b6412093d53
---> a374ab69eb1a
Step 3/8 : ADD . /app
---> 6ed98ee7ad49
Step 4/8 : COPY test.sh .
---> 42184ec64c09
Step 5/8 : ADD analysis /usr/share/elasticsearch/config/analysis
---> 5a96f2098dd7
Step 6/8 : EXPOSE 9202
---> Running in 6c44b54dcc77
Removing intermediate container 6c44b54dcc77
---> d8723189c843
Step 7/8 : EXPOSE 9200
---> Running in c571b4cba1fa
Removing intermediate container c571b4cba1fa
---> 8fa11b03051e
Step 8/8 : RUN "sh test.sh"
---> Running in cf2e8cb3fd37
/bin/sh: sh test.sh: command not found
The command '/bin/sh -c "sh test.sh"' returned a non-zero code: 127
I've tried different combinations of RUN, CMD and ENTRYPOINT for STEP 8
my dockerfile is as follows :
FROM elasticsearch:6.5.4
WORKDIR /app
ADD . /app
COPY test.sh .
ADD analysis /usr/share/elasticsearch/config/analysis
EXPOSE 9202
EXPOSE 9200
RUN "sh test.sh"
I want to run elasticsearch in container and make a new index for elasticsearch