Evgeny Shvarov · Dec 26, 2019

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:


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?

0 219
Discussion (2)2
Log in or sign up to continue

The best solution would be to use docker-compose.yml

version: '3.7'

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: 

        name: othercontainername_default

it should work.