print-color-test
Generates a color PDF and prints it to a networked printer helping to keep your printer's ink flow.
1.5K
This Docker container automatically generates a color test PDF and prints it to a networked Canon printer using CUPS and cron.
It's designed to keep inkjet printers like the Canon Maxify GX7050 healthy by preventing ink from drying out or air from entering the tubes.
Additionally, it provides a Flask-based webserver to monitor print job execution, view logs, and see cron job schedules via a friendly interface.
Ideal for inkjet printer owners who don't print frequently but want to avoid clogged nozzles.
You can pull the image directly from Docker Hub:
docker pull geertmeersman/print-color-test
Or visit the repository directly:
π https://hub.docker.com/r/geertmeersman/print-color-testβ
| Variable | Description |
|---|---|
PRINTER_URI | IPP URI of the printer (e.g. ipp://10.0.0.24:631/ipp/print) |
PRINTER_NAME | Optional printer name (used in notifications only, not in lp) |
PRINTER_IP | IP address of the printer (used by the web interface for status) |
WEB_PORT | Port for the Flask web interface (default: 80) |
SMTP_SERVER | SMTP server (e.g. smtp.gmail.com) to enable email notifications |
SMTP_PORT | SMTP server port (default: 587) |
SMTP_USER | SMTP username (usually same as EMAIL_FROM) |
SMTP_PWD | SMTP password or app password |
EMAIL_FROM | Sender email address |
EMAIL_TO | Recipient email address |
TELEGRAM_BOT_ID | Telegram bot token (e.g. 123456:ABCDEF) |
TELEGRAM_CHAT_ID | Telegram chat ID to receive messages |
π The actual printer used by
lpis hardcoded asMyPrinter.
docker build -t print-color-test .
docker run --rm \
-e PRINTER_URI=ipp://10.0.0.24:631/ipp/print \
-e PRINTER_NAME="Canon GX7050" \
-e PRINTER_IP=10.0.0.24 \
print-color-test
version: '3.8'
services:
print-color-test:
image: geertmeersman/print-color-test
container_name: print-color-test
environment:
PRINTER_URI: ipp://10.0.0.24:631/ipp/print
PRINTER_NAME: Canon GX7050
PRINTER_IP: 10.0.0.24
WEB_PORT: 80
EMAIL_FROM: [email protected]
EMAIL_TO: [email protected]
SMTP_SERVER: smtp.gmail.com
SMTP_PORT: 587
SMTP_USER: [email protected]
SMTP_PWD: your_app_password
TELEGRAM_BOT_ID: 123456:ABCDEF
TELEGRAM_CHAT_ID: -12345678
ports:
- "631:631" # Optional: expose CUPS web interface
- "80:80" # Flask web interface (change if you set WEB_PORT differently)
tty: true
docker-compose up -d
The webserver is automatically started inside the container by:
exec gunicorn --chdir /home/flask --bind 0.0.0.0:$WEB_PORT --worker-class eventlet --timeout 120 web_interface:app
Screenshot

Prints every Friday at 11:00 AM CEST via cron.
Cron job:
0 11 * * 5 /usr/local/bin/weekly_print.sh >> /var/log/cron.log 2>&1
Script: weekly_print.sh
#!/bin/bash
echo "[INFO] Running weekly print job at $(date)"
# Generate PDF
python3 /home/generate_pdf.py
# Print
if lp -d MyPrinter /home/color_test_page_dated.pdf; then
echo "[INFO] Print job succeeded. Sending notifications..."
python3 /home/send_notification.py "SUCCESS" "Color test page printed successfully at $(date)."
else
echo "[ERROR] Print job failed. Sending notifications..."
python3 /home/send_notification.py "FAILURE" "Color test page FAILED to print at $(date)."
fi
docker exec -it <container_id> bash
Inside the container:
lpstat -p # Printer status
lpstat -o # Print queue
cancel -a # Cancel all jobs
/usr/local/bin/weekly_print.sh # Launch the color test print job and push notifications if the environment variables are set
lp -d MyPrinter /home/color_test_page_dated.pdf # Manual print test
/home/test_empty.sh # Generate an empty PDF, send it to the printer and push notifications if the environment variables are set
Questions, feedback, or want to chat?
π¨ Discord: discordapp.com/users/geertmeersmanβ
MIT
To receive print job notifications via Telegram, youβll need:
TELEGRAM_BOT_ID)TELEGRAM_CHAT_ID)@BotFather/newbot
123456789:ABCDefGhIjKlMnOpQRStuvWxYz
TELEGRAM_BOT_IDhttps://api.telegram.org/bot<YOUR_BOT_ID>/getUpdates
https://api.telegram.org/bot123456789:ABCDefGhIjKlMnOpQRStuvWxYz/getUpdates
chat.id in the response:
"chat": {
"id": 123456789,
...
}
-987654321This is your TELEGRAM_CHAT_ID
.envTELEGRAM_BOT_ID=123456789:ABCDefGhIjKlMnOpQRStuvWxYz
TELEGRAM_CHAT_ID=123456789
Content type
Image
Digest
sha256:bcc12d5ceβ¦
Size
198.6 MB
Last updated
11 months ago
docker pull geertmeersman/print-color-test:v3.0.2