Reputation: 515
Here is my docker-compose
services:
api:
image: api
container_name: api
ports:
- "3000:3000"
external_links:
- front
networks:
- global
front:
image: front
container_name: front
ports:
- "8080:80"
external_links:
- api
networks:
- global
networks:
global:
I'm trying to call api from ui container. Here is the call url: http://api:3000/api/search?query=ihpone&page=1&minPrice=0&maxPrice=9999 I'm getting error ERR_NAME_NOT_RESOLVED
Someone can help me ? How to solve my issue. How make request from ui container to api container?
Upvotes: 1
Views: 918
Reputation: 353
When you're opening your UI application on browser you're actually downloading it to host (your machine where docker is installed) and then you're making a call to API.
So in your example you need to set url in your UI application's configuration to be: localhost:3000 instead of api:3000
Upvotes: 4