I have problem if I add script start cron service in ubuntu image then my container booted up for a few seconds then exited, I see log with path docker logs api-nodejs
it show only result * Starting periodic command scheduler cron [ OK ]
In my ubuntu image has install crontab following content
FROM ubuntu:16.04
RUN apt-get update \
&& apt-get install -y curl \
&& apt-get install -y vim \
&& apt-get install -y cron
USER root
# set timezone
ENV TZ 'Asia/Ho_Chi_Minh'
RUN echo $TZ > /etc/timezone && \
apt-get update && apt-get install -y tzdata && \
rm /etc/localtime && \
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata && \
apt-get clean
# install node version 13.*
RUN curl -sL https://deb.nodesource.com/setup_13.x | bash - \
&& apt-get install -y nodejs
RUN npm install -g nodemon
# result installation
RUN node -v
RUN npm -v
RUN nodemon -v
WORKDIR /var/www/html/backend/
EXPOSE 4000
EXPOSE 5000
docker-compose.yml with content
version: "3.3"
services:
app-backend:
container_name: api-nodejs
image: ubuntu:16.04
stdin_open: true
tty: true
build: ./app/backend
volumes:
- ./src/console-be:/var/www/html/backend/
ports:
- "4000:4000"
- "5000:5000"
command: npm run debug
entrypoint: ["/etc/init.d/cron", "start"]
I want to run multiple cmd (start cron service and my api nodejs app) while run docker container.
Is there any solution for me in this case? Thanks!