-
Dockerfile
FROM centos:centos6.8 ENV http_proxy http://proxy.daumkakao.io:3128 ENV https_proxy http://proxy.daumkakao.io:3128 #Install Cron RUN yum clean all && yum install epel-release -y && yum install cronie -y ENV http_proxy '' ENV https_proxy '' # Add crontab file in the cron directory ADD crontab /etc/cron.d/hello-cron # Give execution rights on the cron job RUN chmod 0644 /etc/cron.d/hello-cron # Create the log file to be able to run tail RUN touch /var/log/cron.log # Run the command on container startup CMD crond && tail -f /var/log/cron.log
-
execution
$ sudo docker build -t testcron:testcron . $ sudo docker run -v /etc/localtime:/etc/localtime:ro testcron:testcron
-
ref
-
-
Save hyunjun/56159df74cbf3aafc936c3b199e99891 to your computer and use it in GitHub Desktop.
crontab on Dockerfile
-
Dockerfile
RUN yum install ... python-pip python-devel -y ... RUN pip install --upgrade pip RUN pip install -e hg+https://bitbucket.org/dbenamy/devcron#egg=devcron RUN mkdir /cron ADD cron.speller /cron/crontab ADD test.sh /tmp/test.sh VOLUME ["/cron"] CMD ["devcron.py", "/cron/crontab"] ...
-
ref
-
Dockerfile
RUN yum install ... cronie -y ... ADD crond /etc/pam.d/crond ADD cron.speller /etc/cron.d/cron.speller ADD test.sh /tmp/test.sh RUN chmod 0644 /etc/cron.d/cron.speller RUN touch /var/log/cron.speller.log RUN touch /var/log/cron.test.log RUN crontab /etc/cron.d/cron.speller CMD cron ...
-
ref
-
/etc/pam.d/crond 수정 후 cron 등록
-
Dockerfile
RUN yum install ... cronie -y ... ADD crond /etc/pam.d/crond ADD cron.speller /tmp/cron.speller CMD ["/bin/bash", "start.sh"] ...
-
ref
-
Dockerfile
FROM ubuntu:latest ENV http_proxy http://proxy.daumkakao.io:3128 ENV https_proxy http://proxy.daumkakao.io:3128 #Install Cron RUN apt-get update RUN apt-get -y install cron ENV http_proxy '' ENV https_proxy '' # Add crontab file in the cron directory ADD crontab /etc/cron.d/hello-cron # Give execution rights on the cron job RUN chmod 0644 /etc/cron.d/hello-cron # Create the log file to be able to run tail RUN touch /var/log/cron.log # Run the command on container startup CMD cron && tail -f /var/log/cron.log
-
execution
$ sudo docker build -t testcron:testcron . $ sudo docker run -v /etc/localtime:/etc/localtime:ro testcron:testcron
-
ref
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment