I have a bunch of servers running in docker containers with docker-for-windows. Because of how docker works on windows these all get shoved inside of hyper-v vm and then the containers run there. So to access a server that is bound to localhost, i actually use the ip of the hyper-v virtual adapter.
So i can connect to my server using 10.0.75.2:3579 when im on the host windows machine. Now i want to user zerotier to bridge all my docker containers to a virtual lan so that i can access my containers outside of my schools network. ZeroTier creates a virtual adapter called "zerotier one virtual port": How it works now is that if i run servers on the host windows machine (bare metal) then i can access them using my zerotier ip 10.147.17.221:port. BUT this doesn't connect my docker stuff since its on a different adapter, meaning i must be physically on machine to do any docker related stuff. How do i route or bridge the zerotier adapter to the hyper-v docker adapter so that i can access my docker containers externally using the zerotier ip?
I don't have a windows VM to try this out, but would use a docker network for the purpose. For instance:
docker network create private
docker run --rm --name web --network private -p host_port_1:container_port_1 -p host_port_2:container_port_2 nginx:latest
docker run --rm --name db --network private -p host_port_3:container_port_1 -p host_port_4:container_port_2 postgres:latest
Let me know how it goes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With