How to Make One Docker Container See The Web Service of Another One?
Hi Developers!
I stuck with one interesting problem.
For example, let's use this template repo. If you build this container A using docker-compose and then run the container it exposes REST-API which is available on:
localhost:52773/person/all
The question is how to make this REST-API accessible from another docker container B running on the same machine? E.g. with IRIS 2019.4 Community from this repo?
The problem is that for the second container localhost it's something which belongs to container B.
I think I need to set up a network between containers somehow. E.g. using docker-compose. But is there any simpler way?
The best solution would be to use docker-compose.yml
And each service in such configuration will be able to contact any other service by his name.
Well, the way you were guessing also should work but it is not complex at all.
If you add the following to your docker compose:
it should work.