Шаги для воспроизведения:
Создайте файл docker со следующим содержимым:
Код: Выделить всё
# Use an official Alpine image as a parent image
FROM alpine:latest
# Install cron and any other dependencies you might need
RUN apk update && \
apk add dcron wget curl logrotate
# Add crontab file in the cron directory
ADD crontab /etc/crontabs/root
# Give execution rights on the cron job
RUN chmod 0644 /etc/crontabs/root
# Create the log file to be able to run tail
RUN touch /var/log/cron.log
# Run the command on container startup using the JSON array syntax
CMD ["sh", "-c", "env > /var/log/cron.env && crond -f -d 8"]
Код: Выделить всё
* * * * * /bin/echo "Hello" >> /var/log/cron.log 2>&1
Код: Выделить всё
docker build -t my-alpine-cron .
Код: Выделить всё
2024-07-28 13:10:44 setpgid: Operation not permitted
Версия/сборка ОС: Windows 10 x64
Версия приложения: Docker Desktop 4.32.0< /эм>
Подробнее здесь: https://stackoverflow.com/questions/788 ... -in-docker