Accessing host ip by name


#1

Hi,

host got a:

lxdbr0 Link encap:Ethernet HWaddr fe:f7:d0:b1:6b:b9
inet addr:10.60.117.1 Bcast:0.0.0.0 Mask:255.255.255.0

I can ping 10.60.117.1 from LXD container, but is there a way to know what IP to ping from inside the container without doing an ifconfig in the host first? Thanks,

SQ


#2

The container has a hostname, like mycontainer.lxd, and is accessible from within any container (but not the host, but default).

The IP address you are looking for, is the IP address of the gateway. It does not get a hostname by default and I believe that if there is need, it should be possible to configure LXD's dnsmasq to produce something.

In most cases, you would rather not get the containers to contact a service in the host, but put all services in containers. Do you have a use-case that would require the containers to contact the host?


#3

Hi,

I was trying to run docker inside a lxd container, it works, but too slow, so I am thinking of just run some apps under docker in the host, and let lxd container access host for some docker apps,

Thanks,