Skip to content

docker: add ENABLE_NQPTP to opt out of starting NQPTP - #2288

Merged
mikebrady merged 1 commit into
mikebrady:developmentfrom
haavar:poc/docker-enable-nqptp
Sep 15, 2026
Merged

mikebrady merged 1 commit into
mikebrady:developmentfrom
haavar:poc/docker-enable-nqptp

Conversation

@haavar

@haavar haavar commented Sep 11, 2026

Copy link
Copy Markdown

What this is

Adds an ENABLE_NQPTP environment variable to the Docker image's launcher (docker/run.sh) so a container can be told not to start its own NQPTP.

if [ -z "$SERVICE_TYPE" ] && { [ -z ${ENABLE_NQPTP+x} ] || [ $ENABLE_NQPTP -eq 1 ]; }; then
  echo "Starting NQPTP ($(date))"
  (/usr/local/bin/nqptp > /dev/null 2>&1) &
fi

Why

The launcher starts NQPTP for every AirPlay 2 container. When several AirPlay 2 instances run on one host they should share a single NQPTP — it needs exclusive use of ports 319/320 and is multi-client (it keeps a separate clock per shared-memory interface name). Today, running one instance per room means every container also starts its own NQPTP, and they contend for 319/320. The only way to avoid it was a custom entrypoint.

With this change, you run one dedicated NQPTP (e.g. a sidecar with entrypoint: ["/usr/local/bin/nqptp"]) and set ENABLE_NQPTP=0 on each instance container:

  kitchen:
    image: mikebrady/shairport-sync:latest
    network_mode: host
    ipc: host
    environment: [ENABLE_NQPTP=0]
    command: ["-a", "Kitchen", "--port=7000", "--", "-d", "room_kitchen"]
    depends_on: [nqptp]

Notes

  • Mirrors the existing ENABLE_AVAHI convention in the same script.
  • Default is unchanged — with ENABLE_NQPTP unset (or 1), NQPTP is started exactly as before, so single-instance users and existing setups are unaffected.
  • Classic-only launches (--service-type=classic / airplay1) already skip NQPTP; that is unchanged.

Testing

Built container runs of the image with the modified launcher:

  • ENABLE_NQPTP=0 → the launcher does not print "Starting NQPTP" and no nqptp process is started;
  • default (unset) → "Starting NQPTP" is printed and NQPTP starts, as before.

sh -n docker/run.sh is clean.

This supports the multi-instance-per-host setup discussed in #2266.

The container launcher starts NQPTP for every AirPlay 2 instance. When several
AirPlay 2 instances run on one host they should share a single NQPTP (it needs
exclusive use of ports 319/320 and is multi-client), so the extra per-instance
NQPTPs are unwanted.

Add an ENABLE_NQPTP environment variable, mirroring the existing ENABLE_AVAHI:
set ENABLE_NQPTP=0 to skip starting NQPTP, for instances that use a separate,
shared NQPTP. The default is unchanged -- NQPTP is started as before.
@mikebrady

Copy link
Copy Markdown
Owner

Thanks for this!

@mikebrady
mikebrady merged commit 22d7f2d into mikebrady:development Sep 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants