Documentation
On this page

⚙️ Configuration

Environment Variables

Variable Description Default
LISTEN_ADDR Web listen address :8080
DB_PATH SQLite database path data/cups-web.db
UPLOAD_DIR Directory for uploaded files uploads
CUPS_HOST CUPS address localhost
CUPS_SOCKET_PATH Absolute path to the CUPS Unix socket. Takes precedence over CUPS_HOST when set Empty (TCP)
CUPSADMIN CUPS administrator username print
CUPSPASSWORD CUPS administrator password print
TZ Time zone Asia/Shanghai
COOKIE_SECURE Session and CSRF cookie Secure flag. auto follows the request protocol. true always sets the flag. false always omits it auto
TRUSTED_ORIGINS Comma-separated allowed origins such as https://print.example.com. Set when the origin check rejects a known deployment Empty
PASSKEY_ENABLED Enable passkey sign-in (discoverable credentials, no username needed). Requires HTTPS and a domain. See docs/en/passkey.md false
PASSKEY_RP_ID Passkey RP ID: a domain name, not an IP. Required when enabled Empty
PASSKEY_RP_ORIGINS Allowed full origins, comma-separated. Falls back to TRUSTED_ORIGINS Empty
PASSKEY_RP_NAME Passkey display name CUPS Web
PRINTER_HOST_ALLOWLIST Comma-separated printer URI host allowlist for SSRF protection Empty (no allowlist)
PRINTER_BLOCK_PRIVATE Reject printer URIs that resolve to private addresses when true false
OFD_CONVERTER_JAR OFD-to-PDF converter JAR path /ofd-converter.jar
SCAN_DIR Scan output directory, backed by ./.scans in Compose scans
SCAN_DEVICES_CACHE_TTL Scanner discovery cache lifetime as a Go duration, such as 60s or 24h. scanimage -L can take around 17 seconds. A longer lifetime keeps page transitions fast, and Refresh sends ?force=1 to rediscover connected devices. Values of zero or less disable caching 60s
FONTS_DIR Custom font directory. The container uses /data/fonts, backed by ./.data/fonts /data/fonts in the container or data/fonts on the host

.env.example lists CUPSADMIN, CUPSPASSWORD, and TZ for AIO and commented examples for CUPS_HOST and CUPS_SOCKET_PATH for web-only deployments. AIO can start with the built-in defaults. A web-only deployment needs the external CUPS address or socket.

DB_PATH and UPLOAD_DIR default to relative paths. The image's working directory is /, so they resolve to /data/cups-web.db and /uploads/, as configured in the volume mappings.

AIO runs CUPS and the web app in one container, so CUPS_HOST defaults to localhost. For TCP in a web-only deployment, use the external host or host:port. The default CUPS port is 631. See Connect Through a Unix Socket for the socket setup.

COOKIE_SECURE=auto sets Secure for direct HTTPS (r.TLS) and when the reverse proxy sends X-Forwarded-Proto: https. Plain HTTP on the LAN continues to work. If the proxy reports HTTPS while the client uses HTTP, the browser can lose the session immediately after login. Set COOKIE_SECURE=false for that HTTP deployment.

TRUSTED_ORIGINS is usually unnecessary. Behind a reverse proxy, the origin check can use X-Forwarded-Host. Reverse proxy guide

Command-Line Flags

Flag Description
-addr Listen address. Overrides LISTEN_ADDR

Default Ports

  • CUPS uses 631 for IPP and administration. With host networking in Docker, CUPS listens on port 631 of the host. Issue #107
  • The standalone web binary listens on 8080. For AIO, LISTEN_ADDR in docker-compose.yml defaults to :1180, matching the earlier bridge deployment.

Persistent Data

The default Compose mounts are listed below.

Host path Container path Data
./.etc /etc/cups CUPS configuration, printer queues, and PPDs
./.data /data SQLite database and custom fonts in ./.data/fonts
./.uploads /uploads Original files and converted PDFs
./.drivers /opt/cups-drivers/data Manually installed driver snapshots. Removing this volume loses those drivers on rebuild
./.scans /scans Scan files. SCAN_DIR chooses the directory. Metadata lives in scan_records in .data/cups-web.db

The following mounts support USB printer discovery and hot-plugging.

Host path Container path Purpose
/dev/bus/usb /dev/bus/usb Mount the directory so new device nodes become visible when the printer is switched on
/run/udev /run/udev (read-only) Exposes device attributes to libusb. Omit when the host has no such directory

When upgrading, remove the old /run/dbus/system_bus_socket bind mount. It came from the original AirPrint setup and can prevent container D-Bus and Avahi from starting on a host without Avahi. With host networking, the Avahi instance in the container handles discovery and announcements on the LAN. Issue #94 · Issue #107

Other Compose Options

Option Purpose
network_mode: host Carries mDNS/DNS-SD multicast on UDP 5353 for LAN discovery and AirPrint. CUPS binds directly to host port 631, and LISTEN_ADDR sets the web port. Host Avahi can compete for 5353 and cannot publish for CUPS in the container because the instances use separate D-Bus buses. Stop host Avahi if it conflicts. Issue #107
hostname: CUPS Avahi announces AirPrint and IPP Everywhere as CUPS.local
LISTEN_ADDR=:1180 In host mode, binds the web app to port 1180, preserving bookmarks and reverse proxy configurations
user: root Lets the container run cupsd, lpadmin, and dpkg and modify driver directories such as /usr/lib/cups and /usr/share/ppd
security_opt: [apparmor:unconfined] Avoids AppArmor denials affecting printing and LibreOffice or OFD converter processes in environments such as Proxmox VE LXC. Issue #91
device_cgroup_rules: ['c 189:* rmw'] Gives the container access to USB character devices (major 189). Issue #81
privileged: true Enables full sysfs access for libusb on ARM or embedded platforms, such as Raspberry Pi or Amlogic devices with Armbian. On x86, the device cgroup rule usually suffices. Issue #110