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

  • docker “--volumes-from” files not updating to target containers
  • Hazelcast in Docker in boot2docker “Error while fetching cluster partition table”
  • How to set subnet for Docker 1.9 overflow network?
  • Docker npm install fails
  • debconf warnings despite DEBIAN_FRONTEND inside Docker image
  • Docker: change folder where to store docker volumes
  • 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!

  • Docker container binds to port, but I am unable to ping it
  • malformed HTTP response with docker private registry (v2) behind an nginx proxy
  • Check if image:tag combination already exists on docker hub
  • Spring boot with docker unable to find valid certification path to requested target error
  • Correct way to deploy WAR files in docker image
  • How do I get environment variables to persist into an imported Docker image
  • 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.