Forward exit code 1 from HEALTHCHECK in Dockerfile ?
Author: lukasmrtvyCreated Dec 11, 2018Updated Dec 11, 2018
I am wondering if its possible to forward signal from crontab`s job to dumb-init ? Seems that crontab will always run, no matter of exit codes of its jobs.
What can I do is that instead of exit 1 I will create file and do and Healthcheck in Dockerfile to monitor this file. Unfortunatelly this will mark container as unhealty, but will not exit dumb-init process.
Any idea? Thanks
FROM ubuntu:bionic
RUN apk add --no-cache dumb-init cron && \
echo "#!/bin/sh; echo foo; touch /test.exited; exit 1" > /test.sh && \
echo "* * * * * root /bin/sh /test.sh > /proc/1/fd/1" > /etc/cron.d/test
HEALTHCHECK --interval=5s --timeout=3s \
CMD if [ -f /test.exited ]; then exit 1 ;fi
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/usr/sbin/cron", "-f"]Source: Yelp/dumb-init