Allow binding published ports to 127.0.0.1 only (loopback), not just 0.0.0.0
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 37.4k
- Forks
- 3k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 73
Description
What problem will this feature address?
When publishing a port for a service (e.g. Postgres on 5432), Dokploy always binds it to 0.0.0.0 (or the server's public IP), so the port is reachable from the internet. There's no way to publish it as loopback-only (127.0.0.1:5432:5432), which is the standard way to allow host-local access (e.g. via an SSH tunnel) while keeping the port closed to the network.
Currently the only workarounds are:
- Managing an external firewall (extra moving parts, easy to misconfigure or forget)
- Manually editing the Swarm service after deploy (gets reverted on redeploy)
- Not publishing the port at all and relying only on container-to-container access — which breaks host-side tooling (psql, GUI clients, SSH-tunneled debugging, etc.)
Describe the solution you'd like
Add a "Bind to localhost only" toggle (or a host-IP field, blank = current behavior) next to the Published Port setting for applications/databases. When enabled, Dokploy should publish the port as 127.0.0.1:: instead of 0.0.0.0::, so:
- The port remains reachable from the host itself (e.g. via SSH tunnel)
- It is not reachable from the LAN or public internet
- Container-to-container access via service name is unaffected (this already bypasses host port publishing entirely)
Describe alternatives you've considered
- External firewall rules (UFW/cloud security groups) — works but is an extra layer to keep in sync with Dokploy's own config, and it's easy to forget after redeploys
- VPN/Tailscale for the whole box — solves it but is heavier than needed for just DB access
- Manual docker service update — not idempotent, gets clobbered on the next deploy from Dokploy
Additional context
Related to #2915, which requests binding to an arbitrary host IP (e.g. a VPN interface). This request is the simpler subset of that — just loopback-only — which covers the common "I want to psql/tunnel in for debugging but never expose this to the internet" case, and might be easier to ship first since it doesn't require IP auto-detection across interfaces.
Will you send a PR to implement it?
No
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue does not name files or tests. Start by tracing the Published Port setting through application and database deployment into the Swarm service configuration. Done means a localhost-only option produces 127.0.0.1 binding while preserving container-to-container access and current behavior when disabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, typescript
- Domain
- devops, networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100