Get Started
Quickstart containers Understand the architecture
Migrate to Engine 1.10 Breaking changes Deprecated Engine Features FAQ
Release Notes
Learn about Dockerfiles and Docker Cloud Back up data volumes Create a proxy or load balancer Install the Deploy to Docker Cloud button Integrate with Slack Push images to Docker Cloud SSHing into a Docker Cloud-managed node Upgrade Docker Engine on a node Use the Docker Cloud Agent Using the Docker Cloud CLI
API reference
Quickstart contribution FAQ for contributors Where to chat or get help Style guide for Docker documentation

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.

Mar 5, 2016 at 1:15am (PST) { "docker/apidocs": { "ref": "master", "repos": [ "git@github.com:docker/dhe-deploy.git" ], "sha": "70ac255c88cde0ea6ecf3fcb812783dea7e09da6" }, "docker/cloud-api-docs": { "ref": "master", "repos": [ "git@github.com:docker/cloud-docs.git" ], "sha": "c0539949c40be9abb193271e46d2ea88196f122d" }, "docker/cloud-api-docs-layout": { "ref": "master", "repos": [ "git@github.com:docker/cloud-docs.git" ], "sha": "c0539949c40be9abb193271e46d2ea88196f122d" }, "docker/compose": { "ref": "docs", "repos": [ "git@github.com:docker/compose.git" ], "sha": "9da9555f10abe628e7742476af3f10bd89f68b75" }, "docker/docker": { "ref": "docs", "repos": [ "git@github.com:docker/docker.git" ], "sha": "0e63b073ac8f33335a4d4df3f2aa22120e0b7f43" }, "docker/docker-cloud": { "ref": "master", "repos": [ "git@github.com:docker/cloud-docs.git" ], "sha": "c0539949c40be9abb193271e46d2ea88196f122d" }, "docker/docker-hub": { "ref": "master", "repos": [ "git@github.com:docker/hub2-demo.git" ], "sha": "73ccb2d678ab0cd83067f0c7ef6f3923d750c7bd" }, "docker/docker-trusted-registry": { "ref": "master", "repos": [ "git@github.com:docker/dhe-deploy.git" ], "sha": "70ac255c88cde0ea6ecf3fcb812783dea7e09da6" }, "docker/docs-base": { "ref": "master", "repos": [ "git@github.com:docker/docs-base.git" ], "sha": "5a4cfac3c4d156eda45080c7dcdd2a4c41e08067" }, "docker/kitematic": { "ref": "docs", "repos": [ "git@github.com:docker/kitematic.git" ], "sha": "856a989d834f7fcbcb9bba687539fb159228f6b8" }, "docker/machine": { "ref": "docs", "repos": [ "git@github.com:docker/machine.git" ], "sha": "21edf30337dc5996b5d785ce54d68b4020242f57" }, "docker/notary": { "ref": "docs", "repos": [ "git@github.com:docker/notary.git" ], "sha": "dfeb51f54f2b0cdf20cb55427b7cc8ea2d1cdd0a" }, "docker/opensource": { "ref": "master", "repos": [ "git@github.com:docker/opensource.git" ], "sha": "b994cdd1f74b0aeb0b51fda1249a0c4c8efbf0d0" }, "docker/registry": { "ref": "docs", "repos": [ "git@github.com:docker/distribution.git" ], "sha": "a5bd3e61441873ba6cb40480bda58176733fedb9" }, "docker/swarm": { "ref": "docs", "repos": [ "git@github.com:docker/swarm.git" ], "sha": "b43a2c21c4017726cd9cb17ef9b16f2eef6d1159" }, "docker/toolbox": { "ref": "master", "repos": [ "git@github.com:docker/toolbox.git" ], "sha": "de267d701f94035549ea03e68047d85534286f85" }, "docker/tutorials": { "ref": "master", "repos": [ "git@github.com:docker/tutorials.git" ], "sha": "7af2622fe68a30684d971e4bf3ca7988902e5e26" }, "docker/ucp": { "ref": "docs", "repos": [ "git@github.com:docker/orca.git" ], "sha": "8cd10936a1e063b9be0d5c04de7311a1b2cb25cf" }, "docs.docker.com": { "ref": "refs/heads/v1.10-03-04-2016-165411", "repos": [ "git@github.com:moxiegirl/docs.docker.com.git", "git@github.com:docker/docs.docker.com.git" ], "sha": "5d156add0cb35c1b8f7d2dc1e08f04bd5725792b" } }