How to run a cron job inside a docker container

0 votes
Hii,

How to run a cron job inside a docker container?

My container have only cron.daily and cron.weekly file and  crontab,cron.d, cron.hourly are absent in my container

My container runs with /bin/bash.Any help?
May 18, 2020 in Docker by kartik
• 37,510 points
3,597 views

1 answer to this question.

0 votes

Hii,

crond works well with tiny on Alpine

RUN apk add --no-cache tini

ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/usr/sbin/crond", "-f"]

but should not be run as container main process (PID 1) because of zombie reaping problem and issues with signal handling.

Thank You!

answered May 18, 2020 by Niroj
• 82,720 points

Related Questions In Docker

0 votes
1 answer

How to run a docker command from inside the container?

You must have come across the /var/run/docker.sock file, ...READ MORE

answered Jun 28, 2018 in Docker by Sophie may
• 10,550 points
1,909 views
+5 votes
19 answers
0 votes
2 answers

How to execute docker exec commande inside a docker container ?

You need to get inside the container ...READ MORE

answered Aug 13, 2019 in Docker by Sirajul
• 59,050 points
1,437 views
0 votes
1 answer

How to create a container and run images in docker?

Look for what all images you have ...READ MORE

answered Feb 22, 2019 in Docker by Kalgi
• 52,310 points
568 views
0 votes
1 answer

How to run firefox inside docker container?

Hi@akhtar, Generally, if you run firefox inside docker ...READ MORE

answered Apr 16, 2020 in Docker by MD
• 95,180 points
10,596 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,120 points
1,149 views
0 votes
1 answer

Error:Failed to start redis.service Unit redis-server.service is masked

Hello, If redis.service file is missed in directory path /etc/systemd/system/redis.service so we ...READ MORE

answered May 18, 2020 in Docker by Niroj
• 82,720 points
4,338 views