0

I installed cron and

FROM python:3.9.5
ENV PYTHONUNBUFFERED 1

RUN apt-get update && apt-get install -y netcat && apt-get install -y ftp && apt-get install -y cron

log in the docker image

root@ip-172-31-12-132:/usr/src/app# which ftp
/usr/bin/ftp


root@ip-172-31-12-132:/usr/src/app# ps -aef | grep cron
root      1386   764  0 02:15 pts/1    00:00:00 grep cron

no cron is running

root@ip-172-31-12-132:/usr/src/app# crontab -l
no crontab for root

I guess I have to do something to start cron server.

root@ip-172-31-12-132:/usr/src/app# service crond start
crond: unrecognized service

root@ip-172-31-12-132:/usr/src/app# /etc/init.d/crond start
bash: /etc/init.d/crond: No such file or directory

How can I do this??

whitebear
  • 11,200
  • 24
  • 114
  • 237
  • A Docker container only runs one process; tools like `service` or `/etc/init.d` scripts don't really work inside a container. The easiest approach is to run cron in a separate container from your application, and the linked question describes several setups to do that. – David Maze Apr 22 '22 at 10:07
  • THank you very much I will make another container which works for cron – whitebear Apr 23 '22 at 15:58
  • Thank you very much for your help. I made another `container` in `taskdifinition` and try to invoke `container` from `eventbridge`. However I can choose only `taskdifinition`, not `container` my `taskdifinition` has three `containers` such as `django/nginx/ftp` I want to invoke only `ftp` container , is it possible? – whitebear Apr 23 '22 at 16:55

1 Answers1

0

Try :

apt-get install cron

and then run

/usr/sbin/cron
Philippe
  • 20,025
  • 2
  • 23
  • 32