0

I'm experimenting with docker and I'm looking for the best way to have my container to communicate with a MYSQL DB running on a separate VM. The MYSQL DB is on the host's network.

SO setup is:

  • Docker host VM: (VM IP: 192.168.56.105 | Container eth0 172.17.0.1)
    • Container running wordpress (on apache): 172.17.0.2
  • MYSQL VM IP: 192.168.56.106

I'm looking for a way connect my apache container to 192.168.56.106:3306. Just an extra detail; all VMs are running ubuntu16.04, all of them hosted on my windows laptop using virtualbox

2
  • Why can't you just point the container to use the MySQL server at 192.168.56.106? Mar 27, 2018 at 3:01
  • Yep infact that worker. I was thinking that a network route needed to be setup to point the container gateway (172.17.0.1) to the 192.168.56.x network Mar 27, 2018 at 8:15

1 Answer 1

0

When using Docker, the host's address 172.17.0.1 will be the default gateway for the container. Since the host is also able to reach the MySQL VM, the routing will work out without any manual changes.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .