Docker Community Forums

Share and learn in the Docker community.

How to get the overlay ip for a docker swarm service?


(Allenh) #1

I am using “docker service create” to create a service attaching to a overlay network. entering into the container, it looks like there are two IPs assgined, one is vip, the other is the reachable overlay ip, such as:

257: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UP
link/ether 02:42:0a:00:00:03 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.3/24 scope global eth0
valid_lft forever preferred_lft forever
inet 10.0.0.2/32 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::42:aff:fe00:3/64 scope link
valid_lft forever preferred_lft forever

now, I want to acquire the overlay ip somewhere in a script for this service, but either with the “docker service inspect” or the http api, I can only get the vip. is there a way to retrieve the overlay ip for any service in the cluster?