Scott,

what most people do is look at /proc/1/cgroup and see whether it is '/'.

Since lxc and libvirt both tell init whether it is in a container, you
can also create an upstart job like:

description "track if this is lxc instance"

start on startup

env container
env LIBVIRT_LXC_UUID

pre-start script
        if [ -z $container ]; then
                if [ -z $LIBVIRT_LXC_UUID ]; then
                        stop
                        exit 0
                fi
        fi
end script

Then if, after boot, 'status islxc' shows

        islxc start/running

you know you're in a container.

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to cloud-init in Ubuntu.
https://bugs.launchpad.net/bugs/800856

Title:
  resizefs module causes problems on LXC containers

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/800856/+subscriptions

-- 
Ubuntu-server-bugs mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to