Connect via localhost between docker compose apps

Hi
I have two docker compose files used for two different applications.

Theese two apps are deveoped seperatly but I need to connect them locally when we develop because of some API calls from app2 to app1. I had a central server running app1 so all developers can do the calls to that. But I want to be able to set up a local version.

docker-compose-app1.yml  
 version: '2'
 services:
   app1:
     image: docker/lamp
     restart: allways
     ports:
       - "8080:80"

docker-compose-app2.yml  
 version: '2'
 services:
   app2:
     image: docker/lamp
     restart: allways
     ports:
       - "8070:80"

Both apps have it’s own docker stack with a lot of redis, DB web php etc… The abow example is for illustrating what I want to do.

App 1 uses name based vhosts app1.domain.com:8070 . All links are prefixed with urls (it is a magento store) so I need to call the app with :8070 for it to work both from my laptop and from within app1

How can I from inside the app2 container do api calls to the app1.domain.com via port 8080 ?

Why use two separate Compose files? There’s a relationship between the containers which should be possible to express within only one Compose file where the services share a network (overlay or otherwise). https://docs.docker.com/compose/networking/#/specifying-custom-networks

Well it is two different applications and they are developed seperatly. The app1 is only needed as a service so we see how the api calls work. not all developers of the app2 should have or need to have acces to the app1 code.

It is possible to make an image for this purphose but for the simplicity it would be realy easy to be able to connet to the same port I use on my laptop from within the app2 container.

I will take a look at networking, that is somthing I still need to explore more. Thanks.