How to creating global services using host info as environment vars

I want to create global service which requires a env var PUBLIC_IP, expose to server side to discover them.
So is there a way to create such global service, such as:

        image: private/agent
          - 80:80
          PEER_ADDRESS: ${host.ip} # ip address of rancher host

Compose variables are replaced once, before individual containers are created and scheduled to hosts. You can get information about the host the current container is running on from there Mustafa service.

1 Like