Home > other >  Consult a great god: how to access networks outside the DOCKER runtime IP in the virtual machine
Consult a great god: how to access networks outside the DOCKER runtime IP in the virtual machine

Time:09-26

Problem description: a physical machines IP: 192.168.1.54
Virtual machine a IP: 192.168.1.48 (bridge model direct physical network)
In this virtual machine installed docker, perform the ifconfig
Docker0: flags=4099 & lt; UP, BROADCAST, MULTICAST> Mtu 1500
Inet 172.17.42.1 netmask 255.255.0.0 broadcast 0.0.0.0
Inet6 fe80: : 5484:20: fefe: 9799 prefixlen 64 scopeid 0 x20 & lt; Link>
Mr 56:8 4:7 a: fe: txqueuelen 0 (Ethernet), 97-99
RX packets 58444 bytes (MiB) 3.0 3156853
RX errors 0 dropped overruns frame 0 0 0
TX packets 33368 bytes (MiB) 2.3 2511542
TX errors 0 dropped overruns carrier collisions 0 0 0 0
Perform docker run - d - name ods20160526 -p 8080:8080 order/ods command (mainly is to perform a Java jar command) produced the current container
IP: 172.17.0.2
Now I'm on a physical machine can't ping 172.17.0.2 because it wasn't a network segment, in addition to add the routing table method and any way to ping directly from the physical machine in the docker 172.17.0.2

CodePudding user response:

Container network default is not open to the public, but what of, you can specify a port mapping this statement you should be able to access to the container port 8080 to

Try Telnet 172.17.0.2 8080 see can connect

CodePudding user response:

Two ways:
1, through the custom bridge implementation;
2, through the existing container for forwarding, such as using Ambassador container;

I hope I help you!
  • Related