[virt-tools-list] [virt-what PATCH] docker: Check for /.dockerenv too

Ville Skyttä ville.skytta at iki.fi
Sun Dec 1 05:58:04 UTC 2019


/.dockerinit may no longer exist.

Ref https://github.com/moby/moby/issues/18355
---
 tests/docker/.dockerenv  | 0
 tests/docker/Makefile.am | 1 +
 virt-what.in             | 2 +-
 3 files changed, 2 insertions(+), 1 deletion(-)
 create mode 100644 tests/docker/.dockerenv

diff --git a/tests/docker/.dockerenv b/tests/docker/.dockerenv
new file mode 100644
index 0000000..e69de29
diff --git a/tests/docker/Makefile.am b/tests/docker/Makefile.am
index e0ea991..e2a95d8 100644
--- a/tests/docker/Makefile.am
+++ b/tests/docker/Makefile.am
@@ -21,6 +21,7 @@ TESTS = test.sh
 
 EXTRA_DIST = \
 	test.sh \
+	.dockerenv \
 	.dockerinit \
 	proc/cpuinfo \
 	proc/self/status \
diff --git a/virt-what.in b/virt-what.in
index a61ce91..db16b5f 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -345,7 +345,7 @@ if ! "$skip_lkvm"; then
 fi
 
 # Check for Docker.
-if [ -f "${root}/.dockerinit" ]; then
+if [ -f "${root}/.dockerenv" ] || [ -f "${root}/.dockerinit" ]; then
     echo docker
 fi
 
-- 
2.17.1





More information about the virt-tools-list mailing list