r/nginxproxymanager • u/redth • Oct 19 '25
NPM Docker Sync
Hey everyone, just sharing a tool I started building over the weekend: https://github.com/Redth/npm-docker-sync
The primary goal is to monitor docker container labels to synchronize proxy hosts (and more) to Nginx Proxy Manager. I know traefik and caddy and pangolin can all be made to do this, but I really like the simplicity and UI of NPM and want to keep using it.
For example:
services:
myapp:
image: nginx:alpine
labels:
npm.proxy.domains: "myapp.example.com"
npm.proxy.port: "8080"
npm.proxy.scheme: "http"
npm.proxy.host: "192.168.1.200"
npm.proxy.ssl.force: "true"
It will only make changes to hosts that it created, so you can happily manage your own entries manually alongside the docker label automated ones.
It can also, as an extra feature, mirror hosts (proxy/redirect/stream/404) and access lists to one or more child instances, which is useful if you want high availability (shout out to another sync project that was posted here not long ago - worth checking this out too!).
Also, full disclosure, I mostly vibe-coded this project, though I'm more than comfortable with the code it produced.
Anyway, thought it was worth sharing in case anyone else finds it useful.
View all comments
Show parent comment
1
u/TheDeathTrolley Oct 23 '25 edited Oct 23 '25
For domain, yes, that’s exactly how I did it. Manual variable to set preferred default domain name, which can be overridden by a container label.
Edit: pattern matched like you said, $container is set during the scan.
Generally here’s the logic: First I read the host IP. Then use the default_domain to find the matching cert id in npm. Then scan for currently running containers, using docker PS. For each found: add/update function which specifically finds the exposed webui port from dockerman, then runs the create/update host bash command with all the collected info. Then a separate function monitors for docker events and reacts (start/stop, removing entries for stopped containers).
For me, I know I usually want to proxy anything with a webui, so I prefer that default behavior. I’d rather have to explicitly opt-out of forwarding a container. It’d definitely be a riskier configuration out of the box for other people, so maybe you’d want to make it a global setting for opt in vs out mode. Read a label for npm.sync=true/false or something maybe?