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
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;
});
Top comments (0)