My simple Dockerfile
seems to work, however I'm pretty sure I'm doing something wrong. The container log is empty (docker logs -f <container id>
).
The crond
command is running in foreground (-f
), so why I can't see any ouput?
FROM alpine
RUN apk add --update --no-cache lftp mariadb-client
CMD ["/usr/sbin/crond", "-l", "2", "-f"]
This works for me.
Your Dockerfile.
docker build --tag=60404556 --file=Dockerfile .
# One terminal
docker run --rm --interactive --tty --name=crond 60404556
crond[1]: crond (busybox 1.31.1) started, log level 2
crond[1]: user:root entry:*/15 * * * * run-parts /etc/periodic/15min
crond[1]: user:root entry:0 * * * * run-parts /etc/periodic/hourly
crond[1]: user:root entry:0 2 * * * run-parts /etc/periodic/daily
crond[1]: user:root entry:0 3 * * 6 run-parts /etc/periodic/weekly
crond[1]: user:root entry:0 5 1 * * run-parts /etc/periodic/monthly
...
# Another term
docker container logs --follow crond
crond[1]: crond (busybox 1.31.1) started, log level 2
crond[1]: user:root entry:*/15 * * * * run-parts /etc/periodic/15min
crond[1]: user:root entry:0 * * * * run-parts /etc/periodic/hourly
crond[1]: user:root entry:0 2 * * * run-parts /etc/periodic/daily
crond[1]: user:root entry:0 3 * * 6 run-parts /etc/periodic/weekly
crond[1]: user:root entry:0 5 1 * * run-parts /etc/periodic/monthly
...