tom
tom

Reputation: 172

at command inside docker container

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.

Upvotes: 0

Views: 251

Answers (1)

BMitch
BMitch

Reputation: 263696

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.

Upvotes: 3

Related Questions