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

Ville Skyttä ville.skytta at iki.fi
Fri Jan 4 12:45:08 UTC 2019


/.dockerinit may no longer exist.

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

diff --git a/Makefile.am b/Makefile.am
index 67502fc..6408cfd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -101,6 +101,7 @@ EXTRA_DIST = \
 	tests/bhyve/sbin/dmidecode \
 	tests/bhyve/sbin/uname \
 	tests/bhyve/sbin/virt-what-cpuid-helper \
+	tests/docker/.dockerenv \
 	tests/docker/.dockerinit \
 	tests/docker/proc/cpuinfo \
 	tests/docker/proc/self/status \
diff --git a/tests/docker/.dockerenv b/tests/docker/.dockerenv
new file mode 100644
index 0000000..e69de29
diff --git a/virt-what.in b/virt-what.in
index f685461..f871cc1 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -336,7 +336,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