Connect a container Docker to an external Docker network

Figure 1. Error trying to call another API inside the docker network.
  1. Run the ceb-setting-api executing:
docker-compose -f docker-compose-setting-api.yml up -d 
networks:
providernetwork:
driver: bridge
settingnetwork:
external: true
networks:
- providernetwork
- settingnetwork
# api.rosters.com/.env file#use 
SETTING_SERVICE_URL='http://setting-api:3000/'
#instead of
SETTING_SERVICE_URL='http://localhost:3000/'
docker-compose -f docker-compose-roster-api.yml up -d
Figure 2. Request successfully to call another API inside the docker network.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jhon M. Murillo C.

Jhon M. Murillo C.

I’m Sofware Developer on @Perficient that loves learn!