Publish and expose service or container ports
Docker Cloud has the ability to publish or expose ports in services and containers, this in line with Docker Engine’s own functionality, as discussed here here.
Exposed ports are ports that a container/service is listening to or on which it is providing a service. By default, in Docker Cloud, exposed ports are only privately accessible. What this means is that only other services linked to the service exposing the ports will be able to communicate over the exposed port.
Exposed ports cannot be accessed publicly over the internet.
Published ports are exposed ports that are accessible publicly over the internet. Published ports are published to the node’s (host’s) public facing network interface in which the container is running.
Published ports CAN be accessed publicly over the internet.
Launching a Service with a exposed port
Using the web interface
If the image that you are using for your service already exposes any ports, these will be reflected in Docker Cloud in the Launch new service wizard.
After you select the image in the wizard, click on Advanced options. At the bottom you’ll see a table of ports with the text Click to modify image ports overlayed. Click on it.

This image exposes port 80. Remember, this port will not be accesible publicly over the internet. Only other services that link this service will be able to access this exposed port. To add another port click on Add Port
Using the API/CLI
Please reference our API and CLI documentation here on how to launch a service with a exposed port.
Launching a Service with a published port
Using the web interface
If the image that you are using for your service already exposes any ports, these will be reflected in Docker Cloud in the Launch new service wizard.
After you select the image in the wizard, click on Advanced options. At the bottom you’ll see a table of ports with the text Click to modify image ports overlayed. Click on it.
To publish a port, simply click on the Published checkbox. Once you have done that you have the ability to choose to which port in the node (host) the port will be mapped to, or to have Docker Cloud assign a port dynamically.
To access the published port over the internet, you will use the Node port.

Using the API/CLI
Please reference our API and CLI documentation here on how to launch a service with a published port.
Checking which ports a service has exposed/published
Using the web interface
In the Service detail view, on the left side of the screen, you can see a list of the ports that are exposed (private ports) represented by a lock symbol, as well as a list of the ports that are published (public ports) represented by an organization diagram/tree.
Exposed ports are shown as: (container port/proto)
Published ports are shown as: (node port->container port/proto)

Using the API/CLI
Please reference our API and CLI documentation here on how to get a list of a service’s exposed and published ports.
Service and container DNS endpoints
Container endpoints
Each container that has at least one port published, will automatically get assigned a DNS endpoint in the format container-name[.stack-name].shortuuid.cont.dockerapp.io. This DNS endpoint (single A record) will resolve to the public IP of the node where the container is running. If the container is redeployed into another node, the DNS will be automatically updated.
You can see a list of container endpoints on the stack, service or container detail views, under the Endpoints tab.
Service endpoints
Services that have at least one port published with a fixed host port (i.e. not dynamic) will get assigned a DNS endpoint in the format service-name[.stack-name].shortuuid.svc.dockerapp.io. This DNS endpoint (multiple A record) will resolve to the IPs of the nodes where the containers are running, in a round-robin fashion.
You can see a list of service endpoints on the stack and service detail views, under the Endpoints tab.
