Ping CronMissed from a Docker container
On this page
Put the ping in the image's entrypoint and every command you pass to it is reported: the start, the exit status and the end of the output. The container needs curl and the ping URL as an environment variable, and nothing else changes.
What should a container job send?
- A request to
/startbefore the work, so CronMissed can time the run and notice a job that never finishes. - A request to the plain URL when the work succeeded, or to
/failwhen it did not./<exit status>works too: 0 is a success and any other number is a failure. - The end of the output in the request body, up to 100,000 bytes, so the alert shows the error without a trip to the server.
What are the files?
Dockerfile
FROM alpine:3.20
RUN apk add --no-cache curl
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]entrypoint.sh
#!/bin/sh
# Usage: docker run --env CRONMISSED_PING_URL=... image command args...
: "${CRONMISSED_PING_URL:?set CRONMISSED_PING_URL}"
ping() { curl -fsS --max-time 10 --retry 5 --retry-connrefused -o /dev/null "$@" || true; }
ping "$CRONMISSED_PING_URL/start"
output=$("$@" 2>&1)
status=$?
printf '%s\n' "$output" | tail -c 100000 | ping --data-binary @- "$CRONMISSED_PING_URL/$status"
printf '%s\n' "$output"
exit "$status"Keep the ping URL in an environment variable or a secret store, never in a public repository: the URL is the check's only credential.
How do I run it on a schedule?
crontab
# host crontab
15 3 * * * docker run --rm --env CRONMISSED_PING_URL="https://ping.cronmissed.com/5f0c1b2e-7a3d-4c8e-9b61-2d4f8a7e3c10" example/report /app/nightly-reportThe scheduler stays on the host, as in the Docker and Compose guide, and the container does one job and exits. Do not give such a container a restart policy of always, or it will run again as soon as it ends.
Sources
- Docker Docs: start containers automatically , read 22 October 2026
Questions and answers
- Install curl in the image, or use wget with --post-file if the image has it. Busybox wget supports HTTPS in most current images.
- The wrapper captured the output to send its tail. Printing it again keeps it in docker logs for whoever looks later.
Can I use this with a base image that has no curl?
Why echo the output again at the end?
Create the check these snippets report to
Make a check, copy its ping URL into the snippet, and run the job once.
Start monitoring