From 9fedb3b40b5983372b2c2de29dfe321c6dfaadf4 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Tue, 1 Dec 2015 18:20:02 -0600 Subject: Add detection for docker containers --- src/librc/librc.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/librc/librc.c') diff --git a/src/librc/librc.c b/src/librc/librc.c index 5e5de8d8..cad80333 100644 --- a/src/librc/librc.c +++ b/src/librc/librc.c @@ -269,6 +269,8 @@ rc_sys(void) return RC_SYS_LXC; if (strcmp(systype, RC_SYS_SYSTEMD_NSPAWN) == 0) return RC_SYS_SYSTEMD_NSPAWN; + if (strcmp(systype, RC_SYS_DOCKER) == 0) + return RC_SYS_DOCKER; } if (exists("/proc/xen")) { if (file_regex("/proc/xen/capabilities", "control_d")) @@ -288,6 +290,8 @@ rc_sys(void) return RC_SYS_LXC; else if (file_regex("/proc/1/environ", "container=systemd-nspawn")) return RC_SYS_SYSTEMD_NSPAWN; + else if (file_regex("/proc/1/environ", "container=docker")) + return RC_SYS_DOCKER; #endif return NULL; -- cgit v1.2.3