docker networking direct access to container -


i try migrate multiple vm static ip container based solution.

now i'm using vm static ip:

enter image description here

i can ping , telnet vms telnet 10.48.0.10 5432 , telnet 10.48.0.11 5432

i want create single docker host allows me same :

enter image description here

it great if can telnet 172.17.0.2 5432 , telnet 172.17.0.3 5432

i try via docker because want manage configuration.

what proper way ? should use tcp proxy inside container manage ?

the solution pretty simple.

create network , bind host

docker network create --subnet=10.0.0.0/24 -o "com.docker.network.bridge.host_binding_ipv4"="0.0.0.0" mynet 

then run container on mynet network

docker run -ti --net=mynet --ip=10.0.0.30 busybox 

now computer if add route docker host (192.168.2.156) subnet :

sudo route add -net 10.0.0.0 netmask 255.255.255.0 gw 192.168.2.156 

you can ping container (ping 10.0.0.30)


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -