DEV Community

Krixnaas
Krixnaas

Posted on

2 2

Multiple Laravel Application to Communicate in Docker Container

version: '3'
services:
  app1_server:
    container_name : "app1_server"
    image : "app1_server"
    build :
      context : "app1"
    ports:
      - 8099:80
    volumes:
      - "./app1:/var/www/app1"
    networks:
      net:
        ipv4_address: 10.5.0.5
  app2_server:
    container_name : "app2_server"
    image : "app2_server"
    build :
      context : "app2"
    ports:
      - 8098:80
    volumes:
      - "./app2:/var/www/app2"
    expose:
      - "80"
    networks:
      net:
        ipv4_address: 10.5.0.6
networks:
  net:
    driver: bridge
    ipam:
     config:
       - subnet: 10.5.0.0/16
         gateway: 10.5.0.1
Enter fullscreen mode Exit fullscreen mode

Now you can call from app2 from app1.

For example create test api on app2

Route::get('/api/test', function(){
    return "okay";
});
Enter fullscreen mode Exit fullscreen mode

and create route on app1:

Route::get('test', function(){   
    $response =  Http::withHeaders([
        'Content-Type' => 'charset=UTF8'
    ])->send('get', 'http://10.5.0.6:80/api/test');
    return $response;
});
Enter fullscreen mode Exit fullscreen mode

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more