Answer the question
In order to leave comments, you need to log in
How to output logs from a Docker image?
I have a docker image for crontab. Cron works stably and I can see the logs through docker logs, the log is output to stderr.
But I'm interested in how you can output logs to a file on the host in an arbitrary folder?
I tried to connect the folder in volumes, but it does not work.
I almost forgot to clarify, I work locally on a windows machine.
Dockerfile
FROM alpine:3.6
COPY config/cronjobs /etc/crontabs/root
CMD ["crond", "-f", "-d", "8"]
crontab:
build:
context: ./docker/cron
volumes:
# попытка забиндить папку логов
- ./docker/logs/cron:/var/log/syslog/
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question