64 lines
2.4 KiB
Diff
64 lines
2.4 KiB
Diff
From 6831ccb71a7b19c6e5cb970026cbffff39928e2b Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
|
|
Date: Sun, 1 Dec 2019 08:21:32 +0200
|
|
Subject: [PATCH 24/36] docker: Lookup from /proc/self/cgroup too
|
|
|
|
Refs https://github.com/moby/moby/issues/18355
|
|
|
|
(cherry picked from commit 57f0c3cc6a7e631f644d67f05b002c6004bb6601)
|
|
---
|
|
tests/docker/Makefile.am | 1 +
|
|
tests/docker/proc/self/cgroup | 13 +++++++++++++
|
|
virt-what.in | 3 ++-
|
|
3 files changed, 16 insertions(+), 1 deletion(-)
|
|
create mode 100644 tests/docker/proc/self/cgroup
|
|
|
|
diff --git a/tests/docker/Makefile.am b/tests/docker/Makefile.am
|
|
index e2a95d8..401f372 100644
|
|
--- a/tests/docker/Makefile.am
|
|
+++ b/tests/docker/Makefile.am
|
|
@@ -24,6 +24,7 @@ EXTRA_DIST = \
|
|
.dockerenv \
|
|
.dockerinit \
|
|
proc/cpuinfo \
|
|
+ proc/self/cgroup \
|
|
proc/self/status \
|
|
sbin/dmidecode \
|
|
sbin/uname \
|
|
diff --git a/tests/docker/proc/self/cgroup b/tests/docker/proc/self/cgroup
|
|
new file mode 100644
|
|
index 0000000..5547637
|
|
--- /dev/null
|
|
+++ b/tests/docker/proc/self/cgroup
|
|
@@ -0,0 +1,13 @@
|
|
+12:devices:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
|
+11:blkio:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
|
+10:perf_event:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
|
+9:pids:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
|
+8:cpuset:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
|
+7:rdma:/
|
|
+6:hugetlb:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
|
+5:net_cls,net_prio:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
|
+4:memory:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
|
+3:freezer:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
|
+2:cpu,cpuacct:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
|
+1:name=systemd:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
|
+0::/system.slice/containerd.service
|
|
diff --git a/virt-what.in b/virt-what.in
|
|
index 900a05d..6330fd0 100644
|
|
--- a/virt-what.in
|
|
+++ b/virt-what.in
|
|
@@ -349,7 +349,8 @@ if ! "$skip_lkvm"; then
|
|
fi
|
|
|
|
# Check for Docker.
|
|
-if [ -f "${root}/.dockerenv" ] || [ -f "${root}/.dockerinit" ]; then
|
|
+if [ -f "${root}/.dockerenv" ] || [ -f "${root}/.dockerinit" ] || \
|
|
+ grep -qF /docker/ "${root}/proc/self/cgroup" 2>/dev/null; then
|
|
echo docker
|
|
fi
|
|
|
|
--
|
|
2.31.1
|
|
|