-
Notifications
You must be signed in to change notification settings - Fork 0
Cross Container Communication
Dmytro Somliev edited this page Feb 10, 2022
·
1 revision
- We can use CCC to sent requests to 3rd party API, which is not the par of our Container. That feature works out of the box.
- We can communicate from COntainer to our local machine (mongoDB installed locally e.g.). For this we should use
host.docker.internalinstead oflocalhost(address) in all links (URL) which is responsible for connection. - We can communicate with another Container. Basic solution: grab IP address of Container where we would like to sent a request and use it instead of
localhostin URL. - Docker Network - all Containers can communicate with each other and IPs are automatically resolved.
- To sent request from one Container to another simply put
Container Nameinstead oflocalhostin URL. - It's a good practice to have multiple Containers, where every Container focused on an one thing. App code (1t Container) and DB (2d Container) e.g.