I'm a noob when it comes to docker and aws so it's very likely that I'm missing something trivial but I've been stuck on this issue for quite some time.
So, I have three docker container hosted in aws - contA, contB and contC. contA and contB are part of the same virtual network. contC is a standalone container. contA is a running a koa server which has a bunch of api endpoints registered. contB is running an oauth service. contC is running a nodejs udp server. What I'm trying to do is make a post call to an endpoint inside contA from contC. So inside udp server I'm simply making a fetch post call to 'xxx.com/some/endpoint'. When trying to test if the communication from contC to contA works, I created containers off the images hosted in aws, mapped appropriate pubic and private ports and started the containers. But I got an error saying
'FetchError: request to xxx.com/some/endpoint failed, reason: getaddrinfo ENOTFOUND xxx.com xxx.com:443'
I don't want contC to be part of the same virtual network. I tried adding a --link from contC to contA when creating docker container. But that didn't help. Any insight on how to solve would be really helpful. Thanks!
Update I have understood that the problem is with contC's host name resolution.I am able to access these endpoints on Postman. I am also able to ping other public endpoints. Is there a way to configure the container's /etc/resolv.conf file to resolve xxx.com to xxx.xx.xx.xxx ?