[Lxc-users] Setting up server in lxc container for dummies

Serge Hallyn serge.hallyn at ubuntu.com
Fri Aug 2 22:05:00 UTC 2013


Quoting Dan Kegel (dank at kegel.com):
> Hi,
> I've been happily using ubuntu's stock lxc (originally
> in 12.04, now in 13.04), and finally have an occasion
> to run a server inside a container.  I'd like it to
> be visible from the outside.
> 
> There are plenty of web pages about this, but they seem to
> assume that you've created the lxc config file by hand.
> I have never done that; I just use whatever lxc-create creates.
> 
> What's the simplest way to get a container to look
> like just another host on the LAN, starting with
>    sudo apt-get install lxc
>    sudo lxc-create -t ubuntu -n foobar
> on ubuntu 13.04?

Besides having multiple nics or bridging the container with the host's
eth0, you can also simply forward the ports you want to the container.
If only one container will use a given port on the machine then you can
forward port X on eth0 to port X on the 10.0.3.$(container), else you
can use custom ports.

(Or use ipv6 :)

-serge




More information about the lxc-users mailing list