Rex icon indicating copy to clipboard operation
Rex copied to clipboard

Request: Detect LXC virtualization type

Open djzort opened this issue 8 years ago • 0 comments

From virt-what, lxc containers can be detected as follows. virt-what cites this documentation http://www.freedesktop.org/wiki/Software/systemd/ContainerInterface

if [ -e "${root}/proc/1/environ" ] &&
    cat "${root}/proc/1/environ" | tr '\000' '\n' | grep -Eiq '^container='; then
    echo lxc
fi

/proc/1/environ contains TERM=linux^@container=lxc^@container_ttys=/dev/pts/0 /dev/pts/1^@

djzort avatar Dec 03 '17 13:12 djzort