I have to start two services in one container

I have tried all kinds of variations, and think this is how it is supposed to look. But clearly I am missing something. The container exists right away!

CMD ["start"]
ENTRYPOINT ["/sbin/dockCtrl"]

I also read that I am not supposed to use systemd / service and tried the command direct with no success. (see uncommented command)

build and run command:

docker build -t robotamer/citadel citadel
docker run -d --name="citadel" --hostname="mail" 24fcf023c95e

I can enter the container using -it bash rather then -d and use the dockCtrl bash script just fine.


FROM debian:testing
MAINTAINER RoboTamer <xxxx@gmail.com>
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
    apt-get install -y citadel-suite nano rsync && \
    apt-get clean

EXPOSE 25/tcp 587/tcp 143/tcp 993/tcp 995/tcp 5222 2020/tcp 504/tcp
COPY dockCtrl /sbin/
CMD ["start"]
ENTRYPOINT ["dockCtrl", "start"]

dockCtrl (-rwxr-xr-x):


if test $1 = "start"
    # exec /usr/sbin/citserver -d -x3 -lmail -t/dev/null
    # exec /usr/sbin/webcit -d -p80 -f -c
    service citadel start
    service webcit start

if test $1 = "stop"
    service citadel stop
    service webcit stop

if test $1 = "clean"
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  • 1
    Why did you delete your question and repost it? – Michael Hampton Feb 4 '15 at 15:00
  • I had made a small change and was building in the background. And for a moment it looked like it worked but it didn't so I reposted. Sorry for the inconvenience. I was trying to remove before before bothering someone, sorry again. – RoboTamer Feb 4 '15 at 15:06

Two things to note here:

  • When using ENTRYPOINT, the CMD gets appended to the ENTRYPOINT. Your current Dockerfile will run dockCtrl start start. This probably wasn't what you intended.
  • The dockCtrl script appears to start services and then exit, thus, the container exits. You will need to fire them up with something that can stay in the foreground (supervisord, runit, etc.).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.