On Thu, 2011-05-26 at 01:51 +0200, 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

My current trick is to check:
if [ -f "/proc/1/cgroup" ] && grep -vq "/$" /proc/1/cgroup; then
    echo "lxc!"
fi

This check won't guarantee it's LXC but there shouldn't be too many
other setups where init is in a cgroup.

If there's a more reliable way of doing it, I'm also interested!

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

Attachment: signature.asc
Description: This is a digitally signed message part

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Lxc-users mailing list
Lxc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-users

Reply via email to