After running the container it exits immediately.
How am i suppose to keep this container and ejabberd running?
What changes should i make in dockerfile?
Any help is appreciated.
Here is my dockerfile :
FROM ubuntu:16.04
RUN set -x && \
apt-get update && \
apt-get install -y \
make \
automake \
gcc \
g++\
libexpat1 \
libexpat1-dev \
libyaml-0-2 \
libyaml-dev \
erlang \
openssl \
zlib1g \
zlib1g-dev \
libpam0g \
libtext-iconv-perl \
libssl-dev\
git \
postgresql postgresql-contrib
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 && \
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.0.list \
apt-get install mongodb-org
RUN mkdir -p /root/.ssh
ADD /.ssh/id_rsa /root/.ssh/id_rsa
RUN chmod 600 /root/.ssh/id_rsa
RUN touch /root/.ssh/known_hosts
RUN ssh-keyscan bitbucket.org >> /root/.ssh/known_hosts
RUN git clone git@bitbucket.org:sample.git
RUN cp -a /sample/. /opt/ejabberd/
RUN cd /opt/ejabberd && ./autogen.sh && ./configure --enable-user=root --enable-mysql && make && make install
EXPOSE 5280
RUN cd /opt/ejabberd/
RUN chmod +x /opt/ejabberd/run.sh
ENTRYPOINT ["/opt/ejabberd/run.sh"]
Here is run.sh
#!/bin/bash
set -e
cd /opt/ejabberd
exec sbin/ejabberdctl start "$@"
My build command is :
sudo docker build --no-cache=true -t sample:ejabb .
My run command is :
sudo docker run -d -p 5280:5280 -p 5269:5269 -p 5222:5222 -p 4560:4560 sample:ejabb
Thank you.
Solved. As suggested by https://stackoverflow.com/users/147356/larsks?tab=profile ejabberd process was going into background and hence the container was closing.
so "sbin/ejabberdctl foreground" did the trick.
Thanks.