Saturday, May 2, 2020

user defined networks to connect containers on single node

virtual network.
docker network ls
docker network create -d=bridge company
docker run --rm --d --network company --name customer-api swarmgs/nodewebstress
docker run --rm --d --name balance-api --network company -p 4000:3000 -e MYWEB_CUSTOMER_API=customer-api:3000 swarmgs/nodewebstress
#uses custom network dns to resolve customer-api name

with docker-compose a private n/w(<composefile>_default) will be created with the containers inside it, no need to specify separately.
--company.yml--
docker-compose -f company.yml up -d
docker-compose -f company.yml stop[/start] customer-api

No comments:

Post a Comment