2

I want to use a Crontab to execute a script at 8 o'clock every morning, but my script contains command docker exec -it. So returns following error"cannot enable tty mode on non tty input"

The solution I found was not use the -t parameter, But to interact with docker, I have to allocate tty.

Is there any way to make Crontab create a tty or other better timed execution method?

Edit: The parameters I need to pass to the docker are generated by the Host CentOS . Can I execute cron job inside docker?

Xuesong Ye
  • 505
  • 5
  • 13
  • Possible duplicate of [How to run a cron job inside a docker container?](https://stackoverflow.com/questions/37458287/how-to-run-a-cron-job-inside-a-docker-container) – moebius Aug 09 '18 at 04:50
  • @rahoogan Thank you for your reply, I have two questions. 1. Is there any difference between crontab -e and Add crontab file in the cron directory? 2. Do I need to create a new docker with an operating system to execute crontab? – Xuesong Ye Aug 09 '18 at 07:29

1 Answers1

0

To replace Crontab, I used while 1.

Both & and nohup will be stop when execute command docker exec -it

Screen can solve this problem.

Xuesong Ye
  • 505
  • 5
  • 13