I built a docker image like that:
Dockerfile:
FROM busybox
WORKDIR /
COPY healthcheck.sh .
RUN chmod +x healthcheck.sh
HEALTHCHECK --start-period=1s --interval=2s --timeout=3s --retries=3 CMD /healthcheck.sh || exit 1
CMD while true; do $(echo date); sleep 10; done
helthcheck.sh:
#!/bin/sh
if [ $HOSTNAME ]; then
echo "OK"
exit 0
else
echo "FAIL"
exit 1
fi
My goal is to send an "OK" or "FAIL" in the container's log stream along with a date.
Is there a way to achieve that? "log-driver": "awslogs"
Thanks!