Skip to content

Instantly share code, notes, and snippets.

@Tbruno25
Last active July 31, 2021 18:08
Show Gist options
  • Save Tbruno25/f7a1195951a578d188f13da967fe1223 to your computer and use it in GitHub Desktop.
Save Tbruno25/f7a1195951a578d188f13da967fe1223 to your computer and use it in GitHub Desktop.
Use cron inside ubuntu docker container
#assuming you have some script you want to run with cron
FROM ubuntu:latest
WORKDIR /app
COPY . .
RUN apt-get update
RUN apt-get install -y cron
RUN echo "* * * * * ./app/some-script" >> /etc/cron.d/app
RUN chmod 0644 /etc/cron.d/app
RUN crontab /etc/cron.d/app
CMD ["cron", "-f"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment