Docker Compose Variable Assignment

Hi,

I have a scenario while defining compose yml. I have 2 services defined, the second service need to know the VIP created for service1 to do the deploy. Can anybody suggest how can I fetch and pass these details run time of compose yml.

If I do this manually I can fetch the service VIP by running

[root@swarm1 ~]# docker service inspect etcd -f “{{ .Endpoint.VirtualIPs }}”

However, I’m not finding a way to pass this run time to my second service. Tried environments but it didn’t help.

Any help on this would be highly appreciated !

–Aneesh Raj

Hi,

Can anyone suggest ? thank you !

–Aneesh Raj