StefanScherer / windows-docker-machine

Work with Windows containers and LCOW on Mac/Linux/Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compatibility with Cisco AnyConnect.

teaglebuilt opened this issue · comments

First of all thankyou for your contributions. I am a lifetime linux developer that is now learning the .NET/c#/Windows world and looking to set up a development environment for building docker stacks of our services in .NET 4.7.2 or lower... This repo is a great help! One question I have is about connecting over VPN to authenticate to the companies network. As soon as i connect to vpn, my host machine does not even recognize a docker deamon running. Do you know how i should go about this?

Cisco AnyConnect Client.

From what ive read. I tried adding this line to tell vagrant to share the vpn connection. What i want to find out is wether this is a problem with vagrant, or the docker machine, or all of the above...
I do see in the powershell script, you are using a variable $machineIp to create the docker configurations. but i do not see where you are passing in the ip from the vagrantfile.

config.vm.provider "virtualbox" do |v, override|
    v.gui = false
    v.memory = 2048
    v.cpus = 2
    v.linked_clone = true
    v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
    # override.vm.network :private_network, ip: "192.168.99.90", gateway: "192.168.99.1"
  end

Could you point me in the right direction?

  1. Want docker machine to share or connect to vpn so i can build the .NET services in containers
  2. Eventually, find out how to connect vm to active directory for company credential auth

Thank you!

Well I don't know how Cisco AnyConnect works, but it looks like it excludes all VirtualBox networks?
You could try to spin up a regular Windows VM in VirtualBox and see if you get it working.
Vagrant is just a "command line wrapper" around eg. VirtualBox. And this repo is also just a small wrapper around vagrant to mount your linux home directory to write the docker machine config / docker context files.
Indeed, the PowerShell script retrieves the IP address of the VirtualBox VM to create the machine config and TLS certs. From your host the docker CLI is communicating via TLS to the VM. You could also try to open the VM in VirtualBox, use the cmd terminal in the VM to see if you have outbound network connection.
Another idea is to install the VPN client inside the Windows VM, but it's only a servercore which might be a blocker.

i now have the docker machine connected to vpn but i am having trouble with getting docker context on my mac to connect. Ive switched the settings to bridged. Can you clarify if the windows server needs to be running and what role it plays with the other docker machine vm?

Hm, maybe the VPN client drops all connections from Mac to the VM. 🤔
Did it work without the VPN connection?

vagrant up 2019-box
docker context ls
docker context use 2019-box
docker version
docker context use default  # back to Docker Desktop for Mac

Sure, the VM must be running. I normally have only the 2019-box in use, but the Vagrantfile has several variants available.

$ vagrant status
Current machine states:

2016                      not created (vmware_fusion)
2016-box                  not created (vmware_fusion)
1709                      not created (vmware_fusion)
1803                      not created (vmware_fusion)
1809                      not created (vmware_fusion)
1903                      not created (vmware_fusion)
2019                      not created (vmware_fusion)
2019-box                  running (vmware_fusion)
insider                   not created (vmware_fusion)
lcow                      not created (vmware_fusion)

What you can try is to connect via RDP from Mac to the VM while VPN is connected. vagrant rdp 2019-box - I have the Microsoft Remote Desktop Client installed. If this also does not work, then the VPN client client drops all other networks.

it did work without the vpn but i also had to change the network settings in the vagrant file to bridge settings. so know in the docker context meta.json file...the ip is now three different local ip addresses. i 10.0.0.something for each adapter. Now that the connection is bridged and not private i am wondering what the tcp ip should be for the docker engine? When i build the machine it publishes an http winRM localhost:55985 that i can telnet to so i believe that is how to access the vm. With these settings i am now connected to the vpn network on the vm. But now i am trying to find out how to connect the mac docker to the vm docker. Where did you get the ip from that you used in the docker context on port 2376?

"Host": "tcp://${machineIp}:2376"

The machineIp is retrieved in the powershell script that is called on the first vagrant up -> https://github.com/StefanScherer/windows-docker-machine/blob/master/scripts/create-machine.ps1#L11-L20

Sure, Vagrant adds automatic port forwarding to access eg. WinRM through localhost and a port.
For the TLS connection I haven't added any port forwarding. You could try that if that helps, I normally work with VMware and not VirtualBox, so I'm not so familiar with the networking there.

yeah if vmware was free i would not be using virtualbox. So you mean add 2376 as a forwarded port?