Docker to VM Networking

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

  • Boot2Docker to Google Compute Engine VM: saving Docker container
  • Opening Port in Docker Container
  • Docker out of space with vfs driver
  • How to create notification for success application deployment in ECS Docker?
  • How to make a build arg mandatory during Docker build?
  • Kibana can't reach elasticsearch
  • 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!

  • Viewing all run parameters of a docker container
  • Prevent volume creation on docker run
  • Building in docker and deploying in ubuntu [closed]
  • run “docker run” from crontab
  • How to use docker remote api to create container?
  • Vagrant + docker errors
  • One Solution collect form web for “Docker to VM Networking”

    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?

    If those containers are running on the same host (running one docker daemon), you don’t need a registry, as all containers sees each other through a common docker network (that docker-compose creates by default in its version 2)

    If those containers are running on the different hosts (each running their own docker daemon), you need one more key-value store in order to enable docker container visibility across VMs, allowing you to resolve a container name to its right ip across hosts.
    See “How to make Docker container accessible to other network machines through IP?” and this tutorial.

    http://i.stack.imgur.com/ahLaf.png

    That could replace your redis registry.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.