Bu sorun için searching iken, cron -f
hizmeti başlatmalıyım. Dockerfile'da cron hizmeti neden çalışmıyor?
RUN apt-get install -qq -y git cron
Sonraki Ben:
CMD cron -f && crontab -l > pullCron && echo "* * * * * git -C ${HOMEDIR} pull" >> pullCron && crontab pullCron && rm pullCron
Benim dockerfile hatasız dağıtır ama cron çalışmaz. Eklenmiş bir hat ile cron servisini başlatmak için ne yapabilirim?
PS:
benim cron git fonksiyonu aslında bir kanca olması gerektiğini biliyorum ama bana (ve muhtemelen diğerleri için) için bu Docker ile crons nasıl ayarlanacağını öğrenmek üzeredir :-)
PPS :
Komple Dockerfile (GÜNCELLENDİ):
RUN apt-get update && apt-get upgrade -y
RUN mkdir -p /var/log/supervisor
RUN apt-get install -qq -y nginx git supervisor cron wget
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN wget -O ./supervisord.conf https://raw.githubusercontent.com/..../supervisord.conf
RUN mv ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN apt-get install software-properties-common -y && apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449 && add-apt-repository 'deb http://dl.hhvm.com/ubuntu utopic main' && apt-get update && apt-get install hhvm -y
RUN cd ${HOMEDIR} && git clone ${GITDIR} && mv ./tybalt/* ./ && rm -r ./tybalt && git init
RUN echo "* * * * * 'cd ${HOMEDIR} && /usr/bin/git pull origin master'" >> pullCron && crontab pullCron && rm pullCron
EXPOSE 80
CMD ["/usr/bin/supervisord"]
PPP'ler:
Supervisord.conf:
[supervisord]
autostart=true
autorestart=true
nodaemon=true
[program:nginx]
command=/usr/sbin/nginx -c /etc/nginx/nginx.conf
[program:cron]
command = cron -f -L 15
autostart=true
autorestart=true
Kopyala: http://stackoverflow.com/questions/20545554/how-do-i-start-cron-on-docker-ubuntu-base – Armand
Merhaba @Armand, Bu cevabı buldum, ama yapmadım ' Bir kopyası nasıl anlıyoruz? Bu aslında bana 'cron -f' 'CMD'nin sonuna eklenmesini ekleyen bir soruydu ama bu, –
Docker'ı çalıştırıyor gibi görünmüyor. Tek bir işlemi kullanarak bir örneği başlatıyor. Örnek olarak hangi komutu başlattığınızı ayrıntılı olarak açıklayabilir misiniz? Öğrendiklerim, daha fazla işlem için ihtiyaç duyuyorsanız, denetleyiciyi komut satırından çalıştırmayı ve mevcut olmasını istediğiniz sistem işlemlerini etkinleştirmekten sorumlu tutmalısınız. – Armand