Thanks for that. The lwn.net article is very useful
-AK
On Sun, Sep 15, 2013 at 9:08 PM, Fajar A. Nugraha <l...@fajar.net> wrote:
> On Sun, Sep 15, 2013 at 4:53 PM, Alex <eque...@gmail.com> wrote:
>
>> I'm after a simple example how to configure and run lxc from scratch on
>> Debian Wheezy (e.g. configuring a lxc container manually to run a single
>> process within a container, no networking, would be good).
>>
>>
> Good luck with that :)
>
>
>> All suggestions appreciated.
>>
>>
> It depends on what you need.
>
> A container is a combination of lots of things like chroot and various
> namespaces. I suggest you start by reading http://lwn.net/Articles/531114/ .
> For
> example, if you have a rogue program that binds to all iP addresses by
> default and would like to restrict it to only use one IP address, you might
> find network namespaces most useful.
>
> If you want the least-painful-way to learn about lxc, I'd recommend using
> ubuntu as the host, create a container using the ubuntu template, and then
> install "lxc" package inside the container as well (since you need this to
> be able to run "lxc-execute").
>
> Something that "run a single process within a container" would be
> lxc-execute, but in my experience it doesn't behave the way you want it to.
> For example, if you have /usr/lib/x86_64-linux-gnu/lxc/lxc-init inside the
> container (i.e. you have "lxc" package installed inside the container as
> well), these commands somewhat work ("ffmpeg" is the name of my container):
>
> # lxc-execute -n ffmpeg -- ls
> lxc-init: failed to mount /dev/shm : No such file or directory
> bin boot core data dev etc home lib lib64 media mnt opt proc
> root run sbin selinux srv sys tmp usr var
>
> # lxc-execute -n ffmpeg -- ps -efa
> lxc-init: failed to mount /dev/shm : No such file or directory
> UID PID PPID C STIME TTY TIME CMD
> root 1 0 2 11:03 ? 00:00:00 /usr/lib/lxc/lxc-init --
> ps -efa
> root 2 1 0 11:03 ? 00:00:00 ps -efa
>
>
> ... while an interactive shell doesn't work the way I want it to
>
> # lxc-execute -n ffmpeg -- bash
> lxc-init: failed to mount /dev/shm : No such file or directory
> root@ffmpeg:/# root@ffmpeg:/# root@ffmpeg:/# lxc-execute: Input/output
> error - failed to read
> bin boot core data dev etc home lib lib64 media mnt opt proc
> root run sbin selinux srv sys tmp usr var
> root@ffmpeg:/# exit
>
> [1]+ Stopped lxc-execute -n ffmpeg -- bash
> A ~ # fg
> lxc-execute -n ffmpeg -- bash
>
> (note that I needed to run "fg" at the end to get lxc-execute to stop
> completely at the end).
>
> --
> Fajar
>
------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Lxc-users mailing list
Lxc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-users