Docker Community Forums

Share and learn in the Docker community.

How can I start services like cron and supervisor when build and up a docker container?


(Sirdraake) #1

I’m trying to start the services like cron and supervisor after build and up the container, but the services don’t start, I need to do manually the commands inside the container.

My intention is that these services are already running as soon as the container goes up.

I created a shell script that works for Caddy Web Server start, but don’t for others services.



/usr/bin/caddy --conf /etc/Caddyfile --log stdout
service supervisor start
service cron start

A piece of my Dockerfile

RUN apt-get update && apt-get install --no-install-recommends -y \
    wget \
    nano \
    git \
    unzip \
    iputils-ping \
    gnupg \
    supervisor \

COPY .docker/scripts/ /usr/bin/init-services

RUN chmod +x /usr/bin/init-services

CMD ["/usr/bin/init-services"]