We have been migrating part of our system over to a more microservice-orientated architecture. To run this, we have opted to run them as docker containers. Our architecture at the moment is as follows:
a) Several web servers, hosting the still monolithic PHP application
b) 3 new VM's, which will run
- An "alerting" microservice
- A mongo DB instance
- A custom microservice registry (based on redis)
So, my problem is as follows:
Our current infrastructure is all in the 10.0.0.0/24 range. Docker spins up instances in the 172.x.1.x
range. How do I get the web servers (running on 10.0.0.0/24
) to connect to the services registered with the "registry", which is at 172.17.1.3
(for example)?
I've read up about lots of extensions, such as swarm, compose, etc. But those don't seem to solve the networking problem.
You might say "well you're already exposing the relevant port on the alerting service, just connect to that VM's IP address", but the problem is that when the service (i.e. the NodeJS application inside the docker container) starts up, it registers its exposed port with the service "registry". The registry uses the requesting IP address to build up a sort of path. So the service starts up, and gets registered in the "registry" as 172.17.1.5:3001
. If this is the only way, is there not a way to get the services' host IP address?
Any suggestions? Hope this makes sense!
Thanks for any help!