# Docker 1.12 load balancing

**URL:** <https://forums.docker.com/t/docker-1-12-load-balancing/19664>\
**Category:** General\
**Created:** [August 3, 2016, 2:52pm UTC](https://forums.docker.com/t/docker-1-12-load-balancing/19664 "2016-08-03T14:52:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![revollat](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/revollat/32/2909_2.png) [@revollat](https://forums.docker.com/u/revollat)\
**Post date:** [August 3, 2016, 2:52pm UTC](https://forums.docker.com/t/docker-1-12-load-balancing/19664/1 "2016-08-03T14:52:27Z")

</div>

I’m testing docker 1.12 and as you guys already know : it’s awesome !

The internal DNS to resolve services IP (with round robin, which is fine for simple LB)

But for this to work (e.g. access service app1 from a nginx reverse proxy), a service have to publish a port otherwise the service name can’t be resolved by other services.

I have a nginx reverse proxy with a published port obviously. But I also have to create my services (app1, app2) with published ports so the reverse proxy can work … I don’t know if I miss something, but if, let’s say, app1 exposes port 80, but it’s not publish, when nginx try to proxy the request internally why can’t is resolve app1 IP (with an overlay network private IP for example …) why should I publish service port even when they will never be accessed from outside (only from nginx) …

Thanks 😉

---

<div class="post-metadata">

**Author:** ![nikolashermann](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/nikolashermann/32/12664_2.png) [@nikolashermann](https://forums.docker.com/u/nikolashermann)\
**Post date:** [August 3, 2016, 3:45pm UTC](https://forums.docker.com/t/docker-1-12-load-balancing/19664/2 "2016-08-03T15:45:23Z")

</div>

Hi revollat,

you don’t have to expose the ports, you just have to assign the same network to both the proxy and the apps.

For example:

create a network “proxy\_network”  
`docker network create -d overlay proxy_network`

create your proxy service with published port  
`docker service create --name proxy -p 80:80 --network proxy_network nginx`

create your apps  
`docker service create --name app1 --replicas=2 --network proxy_network app1`  
`docker service create --name app2 --replicas=2 --network proxy_network app2`

Now you can access app1 and app2 from proxy with the internal DNS/LB using the service names as hostnames without any internal ports being published.
