osx - Connecting to webserver running in docker in vagrant in vmware -
on mac running windows server 2016 in vmware. in there running ubuntu in vagrant/virtual box. in there running django app in docker container nginx/uwsgi. webserver listening on 9003, , browser running in windows vm can connect webserver localhost:9003. want able connect both browser running on mac , other machines on local network. in vmware network settings have internet sharing, share mac selected.
in windows vm see this:
$ ipconfig windows ip configuration ethernet adapter vethernet (hns internal nic): connection-specific dns suffix . : link-local ipv6 address . . . . . : fe80::a088:5807:8265:722%11 ipv4 address. . . . . . . . . . . : 192.168.192.1 subnet mask . . . . . . . . . . . : 255.255.240.0 default gateway . . . . . . . . . : ethernet adapter ethernet0: connection-specific dns suffix . : localdomain link-local ipv6 address . . . . . : fe80::440c:bbeb:3408:87a2%6 ipv4 address. . . . . . . . . . . : 172.16.88.128 subnet mask . . . . . . . . . . . : 255.255.255.0 default gateway . . . . . . . . . : 172.16.88.2 ethernet adapter virtualbox host-only network: connection-specific dns suffix . : link-local ipv6 address . . . . . : fe80::d90e:3f15:2ff3:9c8%3 ipv4 address. . . . . . . . . . . : 192.168.56.1 subnet mask . . . . . . . . . . . : 255.255.255.0 default gateway . . . . . . . . . : tunnel adapter isatap.{128ce093-edcd-4551-a68c-1ed0f721c48d}: media state . . . . . . . . . . . : media disconnected connection-specific dns suffix . : tunnel adapter isatap.{c1972449-fa02-4cd9-a894-9f82bcd31099}: media state . . . . . . . . . . . : media disconnected connection-specific dns suffix . : tunnel adapter isatap.localdomain: media state . . . . . . . . . . . : media disconnected connection-specific dns suffix . : localdomain
in vagrant vm:
$ ifconfig docker0 link encap:ethernet hwaddr 02:42:6a:c7:10:cf inet addr:172.17.0.1 bcast:0.0.0.0 mask:255.255.0.0 inet6 addr: fe80::42:6aff:fec7:10cf/64 scope:link broadcast running multicast mtu:1500 metric:1 rx packets:87179 errors:0 dropped:0 overruns:0 frame:0 tx packets:177348 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 rx bytes:17368120 (17.3 mb) tx bytes:1072352935 (1.0 gb) eth0 link encap:ethernet hwaddr 08:00:27:ac:f1:24 inet addr:10.0.2.15 bcast:10.0.2.255 mask:255.255.255.0 inet6 addr: fe80::a00:27ff:feac:f124/64 scope:link broadcast running multicast mtu:1500 metric:1 rx packets:890873 errors:0 dropped:0 overruns:0 frame:0 tx packets:128642 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 rx bytes:1203867192 (1.2 gb) tx bytes:24867499 (24.8 mb) lo link encap:local loopback inet addr:127.0.0.1 mask:255.0.0.0 inet6 addr: ::1/128 scope:host loopback running mtu:65536 metric:1 rx packets:16 errors:0 dropped:0 overruns:0 frame:0 tx packets:16 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 rx bytes:1296 (1.2 kb) tx bytes:1296 (1.2 kb) vetha7780cb link encap:ethernet hwaddr 0e:7b:96:75:ae:68 inet6 addr: fe80::c7b:96ff:fe75:ae68/64 scope:link broadcast running multicast mtu:1500 metric:1 rx packets:5808 errors:0 dropped:0 overruns:0 frame:0 tx packets:10063 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 rx bytes:13697486 (13.6 mb) tx bytes:637891 (637.8 kb)
in docker container:
# ifconfig eth0: flags=4163<up,broadcast,running,multicast> mtu 1500 inet 172.17.0.2 netmask 255.255.0.0 broadcast 0.0.0.0 ether 02:42:ac:11:00:02 txqueuelen 0 (ethernet) rx packets 10155 bytes 891257 (870.3 kib) rx errors 0 dropped 0 overruns 0 frame 0 tx packets 5893 bytes 13702369 (13.0 mib) tx errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<up,loopback,running> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 loop txqueuelen 0 (local loopback) rx packets 506 bytes 184179 (179.8 kib) rx errors 0 dropped 0 overruns 0 frame 0 tx packets 506 bytes 184179 (179.8 kib) tx errors 0 dropped 0 overruns 0 carrier 0 collisions 0
my mac's local ip 10.0.0.19.
from mac tried connecting localhost:9003, did not work. , tried 10.0.0.19, 10.0.2.15, 172.17.0.1, 192.168.192.1, 172.16.88.128, , 192.168.56.1, both mac , machine on local network. did not work.
the firewalls on mac , in windows vm both disabled.
how can connect server mac , other local machines?
update:
$ docker ps container id image command created status ports names 87a9527a1a66 capgraph "/opt/django/capgr..." 2 hours ago 2 hours 443/tcp, 0.0.0.0:80->80/tcp, 8006/tcp capgraph
and in vagrantfile have:
config.vm.network "forwarded_port", guest: 80, host: 9003
you need add network adapter in vmware settings , should bridged wifi network, since using that.
this allow vm have ip in 10.0.0.x
series. , app available on 10.0.0.x:9003
Comments
Post a Comment