The goal: Make an XHR call to http://$IP:$PORT/api/container.json from a web page served by the phpapp container without hardcoding environment variables for IP and Port of the microservice api container.
http://CONSULHOST:8500/v1/catalog/service/api will expose config for my api microservice.
I have Consul installed with Registrator, both working in a Docker Swarm.
I've made a diagram of my use case:
-> swarm ->