CUPS printing server running in a docker container
10K+
infra7/cups)A hardened, modern CUPS container designed for two clear use cases:
proxy variant): A lightweight bridge to expose legacy or network printers over IPP/AirPrint, centralize print queues, or isolate print traffic.full variant): A complete print server with USB passthrough, Avahi/mDNS discovery, D-Bus, HPLIP, and an extensive collection of printer drivers.Available on Docker Hub: infra7/cups
| Tag | Variant | Included Components | Best For |
|---|---|---|---|
latest, <version> | Full | cups, cups-filters, avahi-daemon, dbus, hplip, printer-driver-all, foomatic-db, openprinting-ppds | Direct USB printers, embedded print appliances (e.g., Raspberry Pi), and environments requiring local PPD/driver rendering. |
latest-proxy, <version>-proxy | Proxy | cups, cups-filters | Relaying jobs to IPP/network printers, AirPrint bridging, and minimal-footprint deployments. |
docker-compose.yml)Minimal setup using Docker Secrets for administrative credentials and persistent configuration storage:
name: cups-proxy
services:
cups:
image: infra7/cups:latest-proxy
restart: unless-stopped
environment:
TZ: America/Sao_Paulo
ports:
- "631:631"
secrets:
- cups_admin
- cups_password
ulimits:
nofile:
soft: 65536
hard: 65536
volumes:
- ./config/cups:/etc/cups
secrets:
cups_admin:
file: ./secrets/cups_admin
cups_password:
file: ./secrets/cups_password
docker-compose.yml)Full setup with USB hardware passthrough, mDNS/AirPrint discovery (avahi-daemon), and dbus:
name: cups-server
services:
cups:
image: infra7/cups:latest
restart: unless-stopped
devices:
- /dev/bus/usb:/dev/bus/usb
environment:
TZ: America/Sao_Paulo
START_DBUS_DAEMON: "ON"
START_AVAHI_DAEMON: "ON"
ports:
- "631:631"
- "5353:5353/udp"
secrets:
- cups_admin
- cups_password
ulimits:
nofile:
soft: 65536
hard: 65536
volumes:
- ./config/cups:/etc/cups
- ./config/avahi:/etc/avahi
secrets:
cups_admin:
file: ./secrets/cups_admin
cups_password:
file: ./secrets/cups_password
Before starting either stack, create your credential files:
mkdir -p ./secrets
echo 'admin' > ./secrets/cups_admin
echo 'YourStrongPassword' > ./secrets/cups_password
chmod 600 ./secrets/cups_*
Note: Credentials are read exclusively from secret files (
CUPSADMINFILE/CUPSPASSWORDFILE). If omitted, CUPS starts without an administrative account and Web UI administration remains locked.
| Variable | Default | Description |
|---|---|---|
CUPSADMINFILE | /run/secrets/cups_admin | Path to the file containing the admin username. |
CUPSPASSWORDFILE | /run/secrets/cups_password | Path to the file containing the admin password. |
CUPSERRORLOG | stderr | Log destination (stderr, syslog, or an absolute file path). |
CUPS_SERVER_ALIAS | * | Allowed Host header values (ServerAlias in cupsd.conf). |
CUPS_DEFAULT_ENCRYPTION | IfRequested | TLS policy (IfRequested, Required, or Never). |
START_DBUS_DAEMON | OFF | Enable dbus-daemon inside the container (ON / OFF). |
START_AVAHI_DAEMON | OFF | Enable avahi-daemon for mDNS/AirPrint discovery (ON / OFF). |
TZ | Etc/UTC | Container timezone. |
HOME | /tmp | Writable home directory for auxiliary processes. |
Access the CUPS Web UI at https://<server-ip>:631 (or http://<server-ip>:631, which automatically upgrades to TLS for administrative routes).
Originally inspired by anujdatar/cups-docker.
docker pull infra7/cups:latest