I want to make docker container's IP accessible from the host, just like "Host-only network" that VirtualBox has.
Currently I can ping the windows host from docker container, but not the other way around.
This is my Docker container configuration
/ # ifconfig
eth0 Link encap:Ethernet HWaddr 02:42:AC:11:00:02
inet addr:172.17.0.2 Bcast:172.17.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2091 errors:0 dropped:0 overruns:0 frame:0
TX packets:22137 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:176077 (171.9 KiB) TX bytes:3396902 (3.2 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:6 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:444 (444.0 B) TX bytes:444 (444.0 B)
This is the windows host
Ethernet adapter vEthernet (Default Switch):
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::9197:4f9c:c12b:a2d4%29
IPv4 Address. . . . . . . . . . . : 172.18.0.1
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . :
This is the result when I tried to ping Windows host from container
/ # ping 172.18.0.1
PING 172.18.0.1 (172.18.0.1): 56 data bytes
64 bytes from 172.18.0.1: seq=0 ttl=37 time=1.369 ms
64 bytes from 172.18.0.1: seq=1 ttl=37 time=1.580 ms
64 bytes from 172.18.0.1: seq=2 ttl=37 time=1.524 ms
64 bytes from 172.18.0.1: seq=3 ttl=37 time=1.416 ms
64 bytes from 172.18.0.1: seq=4 ttl=37 time=1.573 ms
64 bytes from 172.18.0.1: seq=5 ttl=37 time=1.428 ms
host
, which let's the docker container use the network of the host directly. Please edit your question to include some info on your final goal.