I have a Dockerfile as bellow:
FROM java:8
MAINTAINER Michael Vu "ducva@arrow-tech.vn"
ENV SOLR_VERSION 5.2.1
ENV SOLR solr-$SOLR_VERSION
ENV SOLR_USER solr
ENV SOLR_PORT 8983
ENV SOLR_COLLECTION mems
COPY $SOLR.tgz /
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y \
curl \
lsof \
procps \
netcat && \
groupadd -r $SOLR_USER && \
useradd -r -g $SOLR_USER $SOLR_USER && \
tar --extract --file $SOLR.tgz && \
tar xzf $SOLR.tgz $SOLR/bin/install_solr_service.sh --strip-components=2 && \
./install_solr_service.sh $SOLR.tgz -p $SOLR_PORT && \
ln -s /opt/$SOLR /opt/solr && \
chown -R $SOLR_USER:$SOLR_USER /opt/solr /opt/$SOLR /var/solr
COPY postgres*.jar /opt/solr/lib/
EXPOSE $SOLR_PORT
WORKDIR /opt/solr
RUN service solr start
CMD ["/bin/bash"]
The purpose is create an image that includes installed solr service.
I can create image successfully by :
docker --tags=ducva/test .
But when I try to run the image by command:
docker run -d --name=test ducva/test
It run, but then stopped, so that I can access it.
Anyone face this issue? how can I make it run in background as normal??