how to use containerapplication running on bridge network from a browser

40 Views Asked by At

Please help with this

  1. I have a windows laptop --> On this installed VM ware Tool --> On this I've Installed Linux OS

  2. Installed docker and stopped firewalld service (then only docker service start)

  3. If I run the docker run command as:

docker run **--network=host** -p 8080:8080 -d tomcat

Then only can access the URL: http://:8080 i.e http://192.168.0.108:8080 (It was IP of Linux VM) from the browser on windows system

  1. If I run the docker command without using the --network=host option I'm not able to access the container application. for example, if running docker run -p 8080:8080 -d tomcat

how can I access all running containers from the windows system browser? Do I need to add a route in the Linux OS (the one Installed in a VM ware Tool) or in the Windows one or change the network settings in VMWare configuration? Docker container Ip start with 172.17.xx.xx series and my windows/LINUX OS was on 192.168.xx.xx series. do need to add any route?

MY network details:

[root@Docker_test ~]# ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:e8ff:fef2:7ed7  prefixlen 64  scopeid 0x20<link>
        ether 02:42:e8:f2:7e:d7  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 500  bytes 23738 (23.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.108  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::20c:29ff:fee6:b685  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:e6:b6:85  txqueuelen 1000  (Ethernet)
        RX packets 2310526  bytes 3211791978 (2.9 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 457745  bytes 45884268 (43.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@Docker_test]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    100    0        0 ens33
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
192.168.0.0     0.0.0.0         255.255.255.0   U     100    0        0 ens33
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

Regards Ram

0

There are 0 best solutions below