Skip to content

Let docker deployments bind published ports to one host address - #660

Open
xianjixiance wants to merge 1 commit into
yc-software:mainfrom
xianjixiance:core/docker-bind-address
Open

Let docker deployments bind published ports to one host address#660
xianjixiance wants to merge 1 commit into
yc-software:mainfrom
xianjixiance:core/docker-bind-address

Conversation

@xianjixiance

@xianjixiance xianjixiance commented Aug 23, 2026

Copy link
Copy Markdown

Summary

The docker target publishes core and the web surfaces with a bare host:container mapping, so they listen on every interface of the host. On a machine with a public address that is an exposure the operator has to paper over with firewall rules outside qm, and a firewall rule in DOCKER-USER does not cover the IPv6 path through docker-proxy.

This adds bindAddress to the config: an IPv4 or IPv6 literal, overridable per invocation with QM_BIND_ADDRESS, that prefixes every published host port. The deployment-layer transport and the URLs qm up and qm outputs print follow the same address. Omitting it keeps today's behaviour.

Notes

  • Validation accepts only IP literals (net.isIP), not hostnames, so a typo cannot silently publish on all interfaces.
  • IPv6 literals are bracketed for docker's -p syntax and for the printed URLs.
  • With sandbox.backend: "local" the sandboxes reach core through PUBLIC_API_URL, so the bind address has to stay routable from the sandbox daemon's containers; the docs say so, and loopback is not a candidate there.

Verification

  • npm run typecheck and the CLI typecheck pass.
  • cli/test/config.test.ts gains cases for valid IPv4 and IPv6 literals and for a hostname, an empty string, and a number being rejected; cli/test/docker-secrets.test.ts now asserts the published port carries the address prefix.
  • eslint and prettier --check on the touched files pass.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

The docker target publishes core and the web surfaces with a bare
host:container mapping, so they listen on every interface of the host.
On a machine with a public address that is an exposure the operator has
to paper over with firewall rules outside qm. Add "bindAddress" to the
config (an IPv4 or IPv6 literal, overridable per invocation with
QM_BIND_ADDRESS) and prefix every published port with it; the
deployment-layer transport and the printed service URLs follow the same
address. Omitting it keeps today's behaviour.
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.

1 participant