Docker Community Forums

Share and learn in the Docker community.

Azure VM as Docker Host with transparent network


(Rhaest1983) #1

Hi all,

I’ve been searching a lot on this topic but I did not find the final answer yet, so I was hoping anyone here could answer my question.

Since we are more and more migrating to Azure, I was hoping I could use an Azure Virtual Machine as my Docker Host. However, I am having troubles accessing containers from outside this VM with internal IP ranges. I know this is possible with Hyper-V (with an internal switch / transparent network) and macaddressspoofing, however this seems not possible on an Azure VM. I tried the described setting as here: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/b09266b0-ac4e-424f-8757-c34547c4adb1/unable-to-ping-containers-created-with-transparent-network-from-other-hosts?forum=windowscontainers but that does not get me what I want.

What I’ve done so far:

  1. Created an Azure Virtual Network with various subnets
  2. Created an Azure Virtual Machine based on Windows Server 2016 with Containers image on one of the subnets (for example internal IP range 10.0.2.0 – 10.0.2.255);
  3. Created an Azure VPN with which you can access the Virtual Machine on it’s internal IP;
  4. Created an Azure Transparent Network with currently the same subnet / gateway as the Azure VM (ideally this would be a different subnet / IP range);
  5. Created a Docker Container which I can reach from inside the Azure VM;

What I would like to accomplish:

  1. I would like to be able to connect to the containers with the internal IP adresses so I don’t have to use all kinds of different port mappings;
  2. This connection would obviously only work when the VPN connection is established;
  3. Example:
    a. Container 1: CONTAINER1 – 10.0.10.10;
    b. Container 2: CONTAINER2 – 10.0.10.11;
    c. Container 3: CONTAINER3 – 10.0.10.12;
    d. Etc.
    e. Establish VPN connection from laptop / work station;
    f. Connect to various environments with respective adresses (http://10.0.10.10, 10.0.10.11etc) or even with hostname if I edit local host file.

Any suggestions how to accomplish what I want? Or is this just not possible? I know a possible alternative is to create a Hyper-V VM as Docker Host inside my Azure VM, but that seems a bit overkill plus I am not even sure if my containers would be reachable from outside my Azure VM.

Any help is much appreciated, thank you in advance.

Kind regards,

Rogier