[Lxc-users] Howto detect we are in LXC contener

Brian K. White brian at aljex.com
Thu May 26 02:31:19 UTC 2011


On 5/25/2011 7:51 PM, David Touzeau wrote:
> Dear all
>
> to detect if we are inside an OpenVZ, openvzve,xen machine
> we can check the presence of :
> /proc/vz/veinfo
> /proc/vz/version
> /proc/sys/xen
> /sys/bus/xen
> /proc/xen
>
> But i did not find any information inside the LXC contener in order to
> detect We are really in an LXC contener.
>
> Is there a tip ??
>
> Best regards

Recent lxc_start sets an environment variable in the init process.

http://lxc.git.sourceforge.net/git/gitweb.cgi?p=lxc/lxc;a=commit;h=3244e75040a98d2854144ebc169a5a61ddbe0a26

But I like the other trick of checking if init is in a cgroup better for 
now, since it will work for containers that were created by other means 
than lxc_start.

-- 
bkw




More information about the lxc-users mailing list