public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/openrc:0.21.x commit in: src/librc/
@ 2016-07-31 19:06 William Hubbs
  0 siblings, 0 replies; only message in thread
From: William Hubbs @ 2016-07-31 19:06 UTC (permalink / raw
  To: gentoo-commits

commit:     40d3795fbacc70349a52efc670a22458f4e2d7c4
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Sun Jul 31 17:24:56 2016 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sun Jul 31 18:50:05 2016 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=40d3795f

librc: fix Docker auto detection

The original auto detection of Docker containers assumed the presence of
a container environment variable. However, Docker-1.12 does not
implement this, and I'm not sure which versions of docker implemented
it.

The new test is for the presence of a file named .dockerenv in the
root directory.

 src/librc/librc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/librc/librc.c b/src/librc/librc.c
index 3e1f0d8..fdde3d5 100644
--- a/src/librc/librc.c
+++ b/src/librc/librc.c
@@ -285,6 +285,9 @@ detect_container(const char *systype)
 		return RC_SYS_RKT;
 	else if (file_regex("/proc/1/environ", "container=systemd-nspawn"))
 		return RC_SYS_SYSTEMD_NSPAWN;
+	else if (exists("/.dockerenv"))
+		return RC_SYS_DOCKER;
+	/* old test, I'm not sure when this was valid. */
 	else if (file_regex("/proc/1/environ", "container=docker"))
 		return RC_SYS_DOCKER;
 #endif


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-07-31 19:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-31 19:06 [gentoo-commits] proj/openrc:0.21.x commit in: src/librc/ William Hubbs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox