liri2006
liri2006

Reputation: 591

Docker for windows: Communication between linux and windows containers

I'm trying to set up development environment for a project using Visual Studio Docker Tools.

I have a bunch of .net core based and few full fx microservices which are communicating through RabbitMq. RabbitMq is inside of a linux based docker container and so does .net core microservices, and they are connected to the same network in docker-compose file. .Net core microservices have no trouble with connecting to RabbitMq by using container name as a hostname.

But when it comes to windows based containers there is a problem that network is not shared between windows and linux docker engines, so I can't connect windows based microservices to the RabbitMq service by using container name (using host IP would be weak for development machine, because it will be different for other developer and will bring some configuration overhead).

AFAIK swarm mode can be used to ensure such communication, but that is more suited for test/prod environments than for development, and also that cool Visual Studio container debug feature will be lost in that case (it runs docker-compose up command).

So what is the best way for mixed-system intercontainer communication on a single host?

Upvotes: 1

Views: 618

Answers (1)

Boggin
Boggin

Reputation: 3416

Create a hosts file where the IP of the RabbitMQ Docker container is set to a name. For example, with Docker Toolbox you could put the following in hosts: 192.168.99.100 docker Then each developer could set the IP and the docker-compose could use the name.

Upvotes: 2

Related Questions