Skip to content

Install Docker Compose Linux

github-actions[bot] edited this page Dec 5, 2026 · 1 revision

Install with Docker Compose on Linux

Status: Tested The image is exercised by the automated end-to-end suite (linux/amd64 in CI, linux/arm64 locally); the host-networking compose.yaml deployment is Tested on Synology. Your particular distribution and LAN are Expected. What the labels mean

This page covers any always-on Linux machine with Docker: a home server, a mini PC, a VM. For specific platforms see Raspberry Pi, Unraid, TrueNAS SCALE, QNAP and Proxmox.

Values used here: printer 192.0.2.10, relay host 192.0.2.20, queue legacy-printer.

What you need

  • A Linux host on the same subnet/VLAN as your iPhones and Macs, with a wired or Wi-Fi connection to the LAN (not behind NAT). A VM works if its network adapter is bridged to the LAN.
  • Docker Engine with Compose v2 or later (the docker compose plugin, not the legacy docker-compose v1; docker compose version prints v2 or a later major version). Install it from docs.docker.com/engine/install.
  • CPU x86_64 or aarch64 (uname -m). There is no 32-bit ARM image.
  • The printer's fixed IP address and protocol (most printers: socket://192.0.2.10:9100).

Docker Desktop on macOS or Windows is not a Linux host for this purpose: it can't send multicast to your LAN. See macOS and Windows.

1. Preflight

Run these on the host:

ping -c 3 192.0.2.10                     # the host reaches the printer
sudo ss -tlnp | grep ':631 '             # TCP 631 must be free
sudo ss -ulnp | grep ':5353 '            # who else speaks mDNS (see below)

Port 631 is in use (usually the distribution's own CUPS, cupsd): either stop it or move the relay.

# Option A: stop the host's CUPS (you won't print *from this host* through it any more). cups-browsed
# would start it again at the next boot, so stop that too and mask cups.service.
sudo systemctl disable --now cups-browsed.service 2>/dev/null || true   # not installed everywhere
sudo systemctl disable --now cups.service cups.socket cups.path
sudo systemctl mask cups.service
# Option B: keep it and set CUPS_PORT=8631 in .env (iPhones learn the port from Bonjour)

After a reboot, run sudo ss -tlnp | grep ':631 ' again; it must still print nothing (if it doesn't, the relay stops with TCP port 631 is already in use).

Something listens on UDP 5353: usually the host's avahi-daemon (desktop distributions, Raspberry Pi OS) or systemd-resolved with MulticastDNS enabled. Leave it running: the relay shares the port and, with AVAHI_HOSTNAME left empty, also the host's name (Expected; tested this way on Synology). A single Host name conflict, retrying with <name>-2 right after start is harmless. If the number keeps climbing, see Troubleshooting.

Firewall: allow TCP 631 (or your CUPS_PORT) and UDP 5353 from the LAN.

# ufw (Debian/Ubuntu)
sudo ufw allow from 192.0.2.0/24 to any port 631 proto tcp
sudo ufw allow from 192.0.2.0/24 to any port 5353 proto udp
# firewalld (Fedora/RHEL)
sudo firewall-cmd --permanent --add-service=ipp --add-service=mdns && sudo firewall-cmd --reload

2. Configure

mkdir -p ~/airprint-relay && cd ~/airprint-relay
curl -fsSLO https://raw.githubusercontent.com/jmoore2333/legacy-printer-airprint-relay/main/compose.yaml
curl -fsSL -o .env https://raw.githubusercontent.com/jmoore2333/legacy-printer-airprint-relay/main/.env.example
nano .env

In .env, set at least:

PRINTER_URI=socket://192.0.2.10:9100
PRINTER_PROFILE=generic-postscript
PAPER_SIZE=Letter
DUPLEX=false
AIRPRINT_NAME=Legacy Printer

.env.example documents every setting; the full list is in the Configuration Reference. Choose a profile on Printer Profiles.

3. Start

docker compose up -d
docker compose logs -f airprint-relay

Wait for [lpar] ready: queue 'legacy-printer' -> socket://192.0.2.10:9100, …, then press Ctrl-C (the relay keeps running). If the container stops with [lpar] ERROR: …, the message names the setting to fix; edit .env and run docker compose up -d again.

4. Verify

docker compose ps                                # STATUS shows (healthy) after up to a minute
docker compose exec airprint-relay lpar-status   # queue idle and enabled, media, mDNS records
avahi-browse -rt _ipp._tcp                       # on any Linux machine with avahi-utils: your printer appears

From a Mac on the same network:

dns-sd -B _ipp._tcp,_universal                   # your printer name appears (Ctrl-C to stop)

In a browser, http://192.0.2.20:631/printers/legacy-printer shows Idle, Accepting Jobs, Shared. Check the logs for [lpar] ERROR: TCP port 631 is already in use (port 631 taken) and a climbing Host name conflict loop (see Troubleshooting); neither should appear. The [lpar] ready: line should end with mDNS container on <your LAN interface>.

Then print: on an iPhone or iPad Share › Print › Printer; on a Mac System Settings › Printers & Scanners › Add Printer, Scanner or Fax…. More on Clients.

Change a setting

Edit .env and run docker compose up -d. Compose re-creates the container; the relay re-applies the settings and keeps the queue state and waiting jobs (named volumes). compose.yaml already passes every variable, so setting it in .env is enough.

Update

docker compose pull
docker compose up -d
docker image prune -f      # optional: remove the old image

To pin a release, set LPAR_IMAGE_TAG=0.1.0 in .env (from 1.0.0 on, 1 follows major version 1). A pinned version gets no security rebuilds; latest does. To roll back, set the previous version and run docker compose up -d.

Uninstall

docker compose down        # stops and removes the container, keeps the volumes
docker compose down -v     # also deletes the queue state and any waiting jobs

If you disabled the host's CUPS, re-enable it with sudo systemctl unmask cups.service && sudo systemctl enable --now cups.service cups-browsed.service.

Without Compose

A plain docker run equivalent is in examples/docker-run.md.

Build the image yourself

Only Docker is needed:

git clone https://github.com/jmoore2333/legacy-printer-airprint-relay.git
cd legacy-printer-airprint-relay
make build IMAGE=ghcr.io/jmoore2333/legacy-printer-airprint-relay:local
cp .env.example .env       # set PRINTER_URI etc.
LPAR_IMAGE_TAG=local docker compose up -d

make e2e IMAGE=ghcr.io/jmoore2333/legacy-printer-airprint-relay:local runs the end-to-end suite against your build (simulated printer, a few minutes).

Host networking alternatives

If the host can't give up port 631 or its mDNS responder, give the relay its own LAN address with macvlan or ipvlan: Networking: Host vs Macvlan.

Clone this wiki locally