Docker & Compose
Add DeadPing pings to containerized cron jobs and healthchecks.
DeadPing monitors containerized cron jobs running in Docker and Docker Compose. Add a curl ping to your container's entrypoint or healthcheck to detect when scheduled tasks inside containers stop running, exit with errors, or take longer than expected.
Entrypoint with Ping
entrypoint.sh
#!/bin/bash
set -euo pipefail
# Run the actual task
python /app/etl.py
# Ping DeadPing on success
curl -fsS --retry 3 --max-time 10 \
"https://deadping.io/api/ping/$DEADPING_PING_TOKEN"Docker Compose
docker-compose.yml
services:
backup:
image: postgres:16
environment:
- DATABASE_URL=${DATABASE_URL}
- DEADPING_TOKEN=${DEADPING_BACKUP_TOKEN}
entrypoint: >
sh -c "pg_dump $$DATABASE_URL | gzip > /backups/db.sql.gz
&& curl -fsS https://deadping.io/api/ping/$$DEADPING_TOKEN"
volumes:
- ./backups:/backups
# Use ofelia or supercronic for container-native cron
scheduler:
image: mcuadros/ofelia:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
ofelia.job-run.backup.schedule: "0 2 * * *"
ofelia.job-run.backup.container: "backup"Dockerfile HEALTHCHECK
Dockerfile
HEALTHCHECK --interval=60s --timeout=10s --retries=3 \
CMD curl -fsS https://deadping.io/api/ping/$DEADPING_TOKEN || exit 1