Merge pull request #124 from neargle/master

Fix the bug that the k8s container cannot be detected
This commit is contained in:
Carlos Polop 2021-04-22 16:08:14 +02:00 committed by GitHub
commit 28fd74ffe5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1100,7 +1100,7 @@ if [ "`echo $CHECKS | grep SysI`" ]; then
#-- SY) Container
printf $Y"[+] "$GREEN"Is this a container? ........... "$NC
dockercontainer=`grep -i docker /proc/self/cgroup 2>/dev/null; find / -maxdepth 3 -name "*dockerenv*" -exec ls -la {} \; 2>/dev/null`
dockercontainer=`grep -i docker /proc/self/cgroup 2>/dev/null; grep -i kubepods /proc/self/cgroup 2>/dev/null; find / -maxdepth 3 -name "*dockerenv*" -exec ls -la {} \; 2>/dev/null`
lxccontainer=`grep -qa container=lxc /proc/1/environ 2>/dev/null`
if [ "$dockercontainer" ]; then echo "Looks like we're in a Docker container" | sed -${E} "s,.*,${C}[1;31m&${C}[0m,";
elif [ "$lxccontainer" ]; then echo "Looks like we're in a LXC container" | sed -${E} "s,.*,${C}[1;31m&${C}[0m,";