[Lxc-users] Container name as DNS name
Serge Hallyn
serge.hallyn at canonical.com
Fri Jul 6 18:56:37 UTC 2012
Quoting Ben Butler-Cole (ben at bridesmere.com):
> I've been looking into this further and I think I've misunderstood how this
> should work.
>
> For some reason I thought that with the default lxcbr0 config the
> containers name would resolve for it as a DNS name. That doesn't seem to be
> the case.
>
> I've tried the ubuntu template and also sshd (on Ubuntu 12.04). Following
> https://help.ubuntu.com/12.04/serverguide/lxc.html, I did the following:
>
> sudo lxc-create -t sshd -n ssh1
> ssh-keygen -f id
> sudo mkdir /var/lib/lxc/ssh1/rootfs/root/.ssh
> sudo cp id.pub /var/lib/lxc/ssh1/rootfs/root/.ssh/authorized_keys
> sudo lxc-start -n ssh1 -d
> ssh -i id root at ssh1.
>
> This doesn't work. "ssh1." doesn't resolve to the container's address.
>
> Any clues what I might be doing wrong?
Do you have 10.0.3.1 (or whatever ip address you have assigned to lxcbr0)
added as a nameserver, i.e. in /etc/resolv.conf?
> I could actually live perfectly happily with the IP address. But I can't
> see any way to recover the IP address for a container that you've just
> created other than greping syslog for dnsmasq logs (or accessing it via the
> console, but I'm using LXC programatically).
>
> Thanks
> -Ben
More information about the lxc-users
mailing list