I have 3 simple microservices (mysql, apirest, gui) that I start using docker-compose:
version: \'3.2\'
services:
mysql:
image: mysql/mysql-server:5.6
AJAX request is the browser request not the server side request and your browser is not a part of mynetwork. To make ajax request (Client browser need to be public domains or map host file with service node port). You still need to map host file in your browser host machine or use full url with service node port in your gui code.
if you want to avoid using port, proxying is the best way to expose service in my case I am using Nginx
GUI--- ajax req(browser to server req)----> PROXY(NGINX)---(server to server)--> apirest