moby / libnetwork

networking for containers
Apache License 2.0
2.16k stars 881 forks source link

endpoint-mode dnsrr not working? #1312

Open rhim opened 8 years ago

rhim commented 8 years ago

When I create the service as follows:

docker service create --replicas 2 --network mynet --name whoami -p 8000:8000 --endpoint-mode dnsrr jwilder/whoami

I cannot access the containers using node-ip:8000. docker service always shows 0 replicas running.

$ docker service ls ID NAME REPLICAS IMAGE COMMAND 8t2el9i65b3b whoami 0/2 jwilder/whoami

Things work just fine when I don't use --endpoint-mode parameter?

I am testing with 1.12.0-rc2.

I don't particularly care for the vip option as I only wanted to expose a service externally. Any ideas what could be amiss?

mavenugo commented 8 years ago

@rhim can you pls share the docker logs ? I think the combination of port-mapping and DNSRR mode are mutually exclusive and it errors out. I will have to confirm this behaviour though.

mavenugo commented 8 years ago

@rhim I see that swarmkit is failing this case of port-publish and DNSRR @ https://github.com/docker/swarmkit/blob/master/manager/allocator/network.go#L396

rhim commented 8 years ago

Hmmm. I was working off of a reply from @mrjana on the following issue #https://github.com/docker/docker/issues/23813.

Quoting: " 1) Start the service using endpoint-mode as dnsrr(but still expose ports) so a vip won't be allocated for the service. 2) you could stand up an L7 LB (like ha-proxy or nginx or F5) exposing the ports that you want the LB to service. " The way I read this is if I put the endpoint-mode as dnsrr and expose ports, I can achieve pretty much the same behavior in terms of routing from an external LB to my service as I can with vip as endpoint-mode w/o additional network metadata for vips etc - since I am really not interested in inter-service communication in a container network.

@mavenugo Could you please clarify if what I am trying to do is intended behavior or not? Additionally, a design doc on routing mesh will be greatly appreciated.