Docker private network individual host access

June 29, 2017 208 views
Docker Ubuntu 16.04 Ubuntu CentOS

Howdy,

We're trying to bring up a DO docker host with 200 containers for testing our agent application and we cannot figure the network part. Let me explain:

  • We are developing an application that is agent-based. An agent is installed on a host and it self-registers with a server to initiate on-going communication.
  • The server then communicates with each host running an agent and send commands.
  • The agents communicate back to the server with a message q
  • Each agent needs its own ip and standard ports with which the server sends commands

I think we can do this with docker Host networking. My thoughts are (forgive my networking ignorance):

  • we give the DO docker host an internal class-b like 172.99.x.x
  • we launch 200+ agent containers in host mode and assign static (or dhcp) addresses to each from the class-b
  • the server is on a remote host that vpns into the DO Docker Host
  • hopefully the server can now "see" the class-b and all of its containers and the containers can communicate with the remote server

I know this is broken... where am i falling down.

Thanks!

2 comments
  • Hi @Digitalocean719
    Just a small note, it's 172.16.0.0 - 172.31.255.255 as per Wikipedia.
    It's a pretty big setup, so it's difficult to understand all the details, but it sounds like that would be one way of setting it up.

  • @hansen I think some code of how you are trying to do this set up would help us understand better.

    I would suggest using Docker Compose with Swarn mode, but about networks... I would suggest you have a very strict way on naming containers and instead using ip:port to connect to your containers, you use sever_name:port to connect to it and let the Docker do the network trick for you.

    Here is how you could use Docker Network:

    1. Create a Docker Network
    docker network create your_network_01
    

    As of Docker Network documentation

    2. Use this network in your docker-compose.yml file:
    networks:
      default:
        external:
          name: your-network-name
    
    3. Connect any Container to your network
    docker network connect your_network_01 your_conteiner_name
    

    As of Docker Network documentation

    Hope it helps!

Be the first one to answer this question.