I am trying to run the at command inside a docker. This command is present in the script, the entrypoint script, which runs when the container is started using the docker run command. Most of the times the at
command runs successfully but for like 1 out of five times, the command does not runs. Is this some kind of bug or am I missing something? Please suggest something.
Asked
Active
Viewed 221 times
0
1 Answers
3
The at
command queues up a task for cron to kick off. Cron is an OS service that is brought up with the OS. Containers are a process isolation tool that do not start the OS services (that's an anti-pattern). What that means is there's no cron daemon to run your command inside the container by default.
To schedule something, you either need the anti-pattern of running the cron daemon as part of your container startup, or preferably you will have your scheduler either outside the container or contained in its own microservice container.

BMitch
- 231,797
- 42
- 475
- 450
-
I think I forgot to mention, there are a few cron jobs also running in the same container and they are running perfectly, so I don't think that "should" (just speculating) be the issue, besides I already mentioned in the question that it fails only 1 out of 5 times on average, so if the issue was cron job startup, then it shouldn't run even once. PS: Sorry for the late reply :) – tom Jun 29 '16 at 06:12
-
I think we'd first need to understand how your cron jobs are running since there isn't a crond by default. More details is needed on your image/container. – BMitch Jun 29 '16 at 21:36
-
I am sorry but I don't have the authority to share anymore about the container. All I can say is that I don't do anything special to run the cron jobs. I mean that I am not starting the crond, its being automatically run. I just append the jobs in crontab through the entrypoint script. – tom Jun 30 '16 at 07:08