[Bug 800856] Re: resizefs module causes problems on LXC containers

Serge Hallyn 800856 at bugs.launchpad.net
Mon Jul 18 19:47:38 UTC 2011


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



More information about the Ubuntu-server-bugs mailing list