virt-what/SOURCES/0023-docker-Check-for-.dockerenv-too.patch
2022-05-10 12:02:21 +00:00

49 lines
1.3 KiB
Diff

From a24df0c780aaf74f0ed408bc55386b9f933fb7aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Sun, 1 Dec 2019 07:58:04 +0200
Subject: [PATCH 23/25] docker: Check for /.dockerenv too
/.dockerinit may no longer exist.
Ref https://github.com/moby/moby/issues/18355
(cherry picked from commit e2c49cda221f95cb65b1b3ac3ae15aa41d92f519)
---
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 59743c3..900a05d 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -349,7 +349,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.18.4