Published ports

Reach an app on a port of the server, for anything that is not a website.

A published port binds a port of the server straight to a port of your container, so clients connect to 203.0.113.10:16379 instead of a domain. Use it for what is not HTTP: game servers, SMTP, raw TCP or UDP.

Publish a port

Open the app's Advanced settings

The Published ports section on Settings -> Advanced

Settings -> Advanced -> Published ports, then Add port. An app can publish up to 20.

Fill in the pair

Prop

Type

Save and deploy

Save, then deploy. The ports bind on the next deploy, like a volume or a resource limit.

The rules

  • It needs the Publish ports grant (canExposePorts), like a database's Host port. Without it the section is read-only. See Host access.
  • Ports under 1024 are refused. They belong to the host, and 80 and 443 to Deplo's proxy. Publish 8025 and let your DNS or firewall do the rest.
  • A host port has one owner per server. A port another app or database on that server already publishes is refused, even one in another team, because servers are shared. A Compose stack's own ports: and processes Deplo did not start are not checked: that clash shows up as Docker's own error at deploy.
  • Pull request previews never publish. They would fight production for the same port.
  • A Compose app publishes its own. The section is not offered: write ports: in the Compose file, which needs the same grant.

A published port is open to whatever can reach the server, and to every container on it. It carries no certificate, no basic auth and none of a domain's middlewares. Put a firewall in front of it, and use a domain whenever the protocol is HTTP.

When not to use one

You wantedDo this instead
A website or an API reachable from outsideAdd a domain. HTTPS is handled for you.
One app to reach anotherNothing. Apps in one environment, on one server, reach each other by name.
An app to reach its databaseNothing. The database answers as db-<name>.
A game server, a mail server, a raw TCP or UDP protocolA published port. This is what it is for.

See also

Did this page help you?

On this page