Docker Community Forums

Share and learn in the Docker community.

Accessing docker container from a remote host

Hi,

I have two virtual machines (Virutalbox VM’s). One of the virtual machine has docker and the other one isn’t. Let’s name them VirtualMachine1 & VirtualMachine2. VirutalMachine1 has docker container. This container has a database instance. VirtualMachine2 does not have docker installed but VirtualMachine2 has another instance of the same database. Now I would like to form a cluster of these database instances. But I am not able to access docker container from VirtualMachine2?

VirtualMachine 2 IP address - 192.168.1.18
VirtualMachine 1 IP address - 192.168.1.17
Docker Container IP address from Ifconfig - 172.17.0.1
Docker Container IP address from inside the container - 172.17.0.2

But I can access the database instance admin GUI console using port forward using the below command -
docker run -d --name instance1 -p 7030-7035:8091-8094 -p 21210:11210 abcd

This doesn’t serve my purpose. To form a cluster both the instances must be able to communicate to each other. So when I ping from VirtualMachine2 to Docker Container I don’t get any response. But I can ping between VirtualMachine1 & VIrtualMachine2. I can access docker container using docker container ip address in VirtualMachine1(where docker container is hosted). Could you please let me know how to access docker container on a remote host where, all three
(remote host, docker container and virtual machine hosting the docker container) are on the same LAN?