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.
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
stop
exit 0
if [ -z $container ]; then
if [ -z $LIBVIRT_LXC_UUID ]; then
fi
fi
end script
Then if, after boot, 'status islxc' shows
islxc start/running
you know you're in a container.