An Interest In:
Web News this Week
- April 27, 2024
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
April 13, 2022 02:20 am GMT
Original Link: https://dev.to/krixnaas/multiple-laravel-application-to-communicate-in-docker-container-36l0
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.6networks: net: driver: bridge ipam: config: - subnet: 10.5.0.0/16 gateway: 10.5.0.1
Now you can call from app2 from app1.
For example create test api on app2
Route::get('/api/test', function(){ return "okay";});
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;});
Original Link: https://dev.to/krixnaas/multiple-laravel-application-to-communicate-in-docker-container-36l0
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To