Add detection for docker containers
This commit is contained in:
parent
635e33cdc8
commit
9fedb3b40b
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
# This is the subsystem type. Valid options on Linux:
|
# This is the subsystem type. Valid options on Linux:
|
||||||
# "" - nothing special
|
# "" - nothing special
|
||||||
|
# "docker" - Docker container manager
|
||||||
# "lxc" - Linux Containers
|
# "lxc" - Linux Containers
|
||||||
# "openvz" - Linux OpenVZ
|
# "openvz" - Linux OpenVZ
|
||||||
# "prefix" - Prefix
|
# "prefix" - Prefix
|
||||||
|
@ -223,6 +223,8 @@ Same as -jail, but for VServer systems.
|
|||||||
Same as -jail, but for Xen DOM0 systems.
|
Same as -jail, but for Xen DOM0 systems.
|
||||||
.It Dv -xenu
|
.It Dv -xenu
|
||||||
Same as -jail, but for Xen DOMU systems.
|
Same as -jail, but for Xen DOMU systems.
|
||||||
|
.It Dv -docker
|
||||||
|
Same as -jail, but for docker systems.
|
||||||
.El
|
.El
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
|
@ -269,6 +269,8 @@ rc_sys(void)
|
|||||||
return RC_SYS_LXC;
|
return RC_SYS_LXC;
|
||||||
if (strcmp(systype, RC_SYS_SYSTEMD_NSPAWN) == 0)
|
if (strcmp(systype, RC_SYS_SYSTEMD_NSPAWN) == 0)
|
||||||
return RC_SYS_SYSTEMD_NSPAWN;
|
return RC_SYS_SYSTEMD_NSPAWN;
|
||||||
|
if (strcmp(systype, RC_SYS_DOCKER) == 0)
|
||||||
|
return RC_SYS_DOCKER;
|
||||||
}
|
}
|
||||||
if (exists("/proc/xen")) {
|
if (exists("/proc/xen")) {
|
||||||
if (file_regex("/proc/xen/capabilities", "control_d"))
|
if (file_regex("/proc/xen/capabilities", "control_d"))
|
||||||
@ -288,6 +290,8 @@ rc_sys(void)
|
|||||||
return RC_SYS_LXC;
|
return RC_SYS_LXC;
|
||||||
else if (file_regex("/proc/1/environ", "container=systemd-nspawn"))
|
else if (file_regex("/proc/1/environ", "container=systemd-nspawn"))
|
||||||
return RC_SYS_SYSTEMD_NSPAWN;
|
return RC_SYS_SYSTEMD_NSPAWN;
|
||||||
|
else if (file_regex("/proc/1/environ", "container=docker"))
|
||||||
|
return RC_SYS_DOCKER;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -329,6 +329,7 @@ bool rc_service_daemons_crashed(const char *);
|
|||||||
/*! @name System types
|
/*! @name System types
|
||||||
* OpenRC can support some special sub system types, normally virtualization.
|
* OpenRC can support some special sub system types, normally virtualization.
|
||||||
* Some services cannot work in these systems, or we do something else. */
|
* Some services cannot work in these systems, or we do something else. */
|
||||||
|
#define RC_SYS_DOCKER "DOCKER"
|
||||||
#define RC_SYS_JAIL "JAIL"
|
#define RC_SYS_JAIL "JAIL"
|
||||||
#define RC_SYS_OPENVZ "OPENVZ"
|
#define RC_SYS_OPENVZ "OPENVZ"
|
||||||
#define RC_SYS_LXC "LXC"
|
#define RC_SYS_LXC "LXC"
|
||||||
|
Loading…
Reference in New Issue
Block a user