[Lxc-users] Getting IP address of running container

Tamas Papp tompos at martos.bme.hu
Thu Jul 11 15:31:26 UTC 2013


On 07/11/2013 04:45 PM, Robin Monjo wrote:
> Hello,
>
> I need to know the IP address of a running container in order to add a port forwarding rule with iptables.  My containers are build using the default ubuntu template and use dhcp to obtain an IP.
>
> I'm able to access the ip by reading the /var/lib/misc/dnsmasq.leases file. However I'm not sure this is reliable.
>
> What do you think ? Any better way to do it ?
>

What version of LXC do you use?
In 0.9 it works from API, at least 'lxc-ls --fancy' prints the guest IP.

tamas




More information about the lxc-users mailing list