How to connect multiple Docker Containers?

Reason

OK — so how do we fix this issue?

1. Manual Docker Networking

doker network create my-data-network
docker run --name=data-provider --net=my-data-network -p 8081:8081 data-provider-image
docker run --name=data-consuer --net=my-data-network -p 8082:8082 data-consumer-image
docker network connect my-data-network data-provider

2. Docker-Compose file

2.1 Networks Property

2.2 depends_on property

Finally

Before in data-consumer

http://localhost:8081

After in data-consumer

http://data-provider:8081

--

--

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