Documentation
On this page

πŸš€ Quick Start

Choose a deployment:

  • Docker Deployment runs CUPS and the web app together and is recommended for a new installation.
  • Web-Only Image connects to an existing CUPS server or a separate CUPS image.
  • Standalone Binary runs the web app on a host with CUPS already configured.

Docker Deployment

Prerequisites

  • Docker and Docker Compose
  • A USB printer if you are connecting a printer directly

1. Create docker-compose.yml

services:
  cups:
    image: hanxi/cups-web:latest
    container_name: cups
    user: root
    hostname: CUPS
    # Host networking allows LAN multicast for mDNS/DNS-SD discovery and
    # AirPrint advertisements (issue #107).
    network_mode: host
    security_opt:
      - apparmor:unconfined
    environment:
      - CUPSADMIN=${CUPSADMIN:-print}
      - CUPSPASSWORD=${CUPSPASSWORD:-print}
      - TZ=${TZ:-Asia/Shanghai}
      # With host networking, the web app listens directly on host port 1180.
      - LISTEN_ADDR=${LISTEN_ADDR:-:1180}
      # Scans go to the ./.scans:/scans volume below.
      - SCAN_DIR=${SCAN_DIR:-/scans}
    volumes:
      - ./.etc:/etc/cups
      - ./.data:/data
      - ./.uploads:/uploads
      - ./.drivers:/opt/cups-drivers/data
      - ./.scans:/scans
      - /dev/bus/usb:/dev/bus/usb
      - /run/udev:/run/udev:ro
    device_cgroup_rules:
      - 'c 189:* rmw'
    # libusb may need full sysfs access to enumerate USB printers on ARM and
    # embedded platforms (issue #110). Omit this on x86 if it is unnecessary.
    privileged: true
    restart: unless-stopped

You can also download the repository's Compose file:

wget https://raw.githubusercontent.com/hanxi/cups-web/master/docker-compose.yml

latest is the latest tagged release. dev is built on pushes to master. To try it, change image: hanxi/cups-web:latest to image: hanxi/cups-web:dev.

2. Set Environment Variables (Optional)

Create .env next to the Compose file:

CUPSADMIN=print
CUPSPASSWORD=your_cups_password
TZ=Asia/Shanghai

3. Start the Service

docker compose up -d

4. Install a Printer Driver (If Needed)

Most printers work with the bundled drivers. Install a model-specific driver when needed.

  1. Open http://localhost:1180 and sign in with admin/admin.
  2. Open Drivers as an administrator.
  3. Click Scan printers to detect connected printers.
  4. Select Install and add for the detected printer.

The installation job runs in the background and streams its log. A source build can take several minutes or longer. Keep the page open while it runs. The service accepts one driver job at a time. Driver management in the web UI

You can also install the driver from the command line:

docker exec cups driver-install canon-ufr2

5. Configure the Printer

If the detection tool did not add the printer, open http://localhost:631, sign in with the CUPS administrator account, and add it manually.

For a printer connected to a Windows computer, add its SMB share in CUPS. The guide covers a dedicated account, driver setup, and publishing only the web port. Add a Windows shared printer

After adding a printer, set it to Shared in CUPS so the web app can discover it.

6. Open the Web App

Open http://localhost:1180. The initial username is admin and the initial password is admin. Change the password after signing in.

tzishue/cloud-printer is an alternative CUPS image with additional model-specific drivers.


Web-Only Image (External CUPS)

Use the web-only image when you already run CUPS. It provides the web interface, multiple users, print records, and Office, OFD, and PDF conversion. It connects to CUPS over TCP via CUPS_HOST or over a Unix socket via CUPS_SOCKET_PATH.

Tags Contents
hanxi/cups-web:latest / dev / vX.Y.Z Combined CUPS and web app
hanxi/cups-web:latest-web / dev-web / vX.Y.Z-web Web app for an external CUPS server

Install drivers and share the printers in external CUPS first. Verify that the web container can reach its IPP service. External CUPS handles printer configuration, driver installation, and AirPrint. The web-only image omits local USB scanning and driver-management tools and runs without a USB mount or privileged mode.

For TCP, add the CUPS address to .env:

CUPS_HOST=192.168.1.100:631

Start the service using the repository's docker-compose.web.yml:

docker compose -f docker-compose.web.yml up -d

Open http://localhost:1180, sign in with admin/admin, and change the password. The database and uploads persist in ./.data and ./.uploads.

Use a host reachable from the web container or a CUPS service in the same Docker network, in host:port format. Inside the web container, localhost refers to that container. When using a separate CUPS container, attach both services to the same Docker network and follow the CUPS image's setup instructions.

Connect Through a Unix Socket

On one host, you can share the CUPS runtime directory and connect over its socket. Enable the listener in the external cupsd.conf:

Listen /var/run/cups/cups.sock

When connecting to CUPS on the host, use the repository's socket Compose override:

docker compose -f docker-compose.web.yml -f docker-compose.web.socket.yml up -d

The override mounts the host's /var/run/cups read-only in the web container and sets CUPS_SOCKET_PATH=/var/run/cups/cups.sock. If CUPS uses a different runtime directory on the host, set CUPS_SOCKET_DIR in .env. The socket configuration takes precedence over CUPS_HOST.

For two containers, mount the same runtime volume in both services. Adapt this example to your service and volume names:

services:
  cupsd:
    volumes:
      - cups_runtime:/var/run/cups
  web:
    image: hanxi/cups-web:latest-web
    ports:
      - "1180:8080"
    environment:
      CUPS_SOCKET_PATH: /var/run/cups/cups.sock
    volumes:
      - cups_runtime:/var/run/cups:ro
      - ./.data:/data
      - ./.uploads:/uploads
    restart: unless-stopped
volumes:
  cups_runtime:

Mount the whole directory so the web container follows socket recreation when CUPS restarts. The web process still needs permission to traverse the directory and connect to the socket. Unix permissions apply to read-only mounts as usual.

CUPS_SOCKET_PATH must be an absolute path visible inside the web process's environment. After it is set, a missing socket, permission error, or connection failure aborts the request and logs the cause. The web app keeps printer URIs in HTTP or IPP format and uses localhost:631 as the placeholder host. Network communication uses the Unix socket. Historical print records and schedules use the same connection. If you switch CUPS servers, preserve the names of the queues they reference.

Socket mode uses the configured socket as its fixed destination. PRINTER_HOST_ALLOWLIST and PRINTER_BLOCK_PRIVATE apply to TCP only. External CUPS continues to enforce its access policy and manage drivers, queues, and AirPrint.

Build the web-only image locally if you need it before a new tag is available:

make docker-build-web
# Set the image in docker-compose.web.yml to cups-web:web, then start it.

Standalone Binary

Use the binary when you already operate a CUPS server. Install and configure CUPS and your printer drivers separately.

  • Driver installation. The AIO image supplies driver-install and the persistence directory /opt/cups-drivers. Without those files, the Drivers page displays drivers as uninstalled and disables installation. Direct API calls to install them fail with no such file or directory. Use the host package manager, such as apt install printer-driver-*, or the CUPS administration UI.
  • Printer discovery needs lpinfo from the cups-client package. The scan action reports failed to detect printers when it is missing.
  • Office, OFD, and PDF normalization require system installations of LibreOffice, Java, and Ghostscript as applicable.

1. Download the Binary

Find a build for your platform in GitHub Releases.

Platform Architecture Filename
Linux amd64 cups-web-linux-amd64
Linux arm64 cups-web-linux-arm64
Linux armv7 cups-web-linux-armv7
Linux loong64 cups-web-linux-loong64
macOS amd64 cups-web-darwin-amd64
macOS arm64 cups-web-darwin-arm64
Windows amd64 cups-web-windows-amd64.exe
wget https://github.com/hanxi/cups-web/releases/latest/download/cups-web-linux-amd64
chmod +x cups-web-linux-amd64

2. Configure and Run

export CUPS_HOST=localhost:631
export DB_PATH=./data/cups-web.db
export UPLOAD_DIR=./uploads
export LISTEN_ADDR=:8080

./cups-web-linux-amd64

The command-line flag overrides the environment:

./cups-web-linux-amd64 -addr :8080

The Docker image bundles OFD printing support. To enable it with the standalone binary, install a Java runtime (the image uses Java 21) and place ofd-converter.jar at /ofd-converter.jar, or configure the converter path.

3. Open the Web App

Open http://localhost:8080 and sign in with admin/admin.