summaryrefslogtreecommitdiff
path: root/Software/systemd/ContainerInterface.mdwn
diff options
context:
space:
mode:
Diffstat (limited to 'Software/systemd/ContainerInterface.mdwn')
-rw-r--r--Software/systemd/ContainerInterface.mdwn2
1 files changed, 1 insertions, 1 deletions
diff --git a/Software/systemd/ContainerInterface.mdwn b/Software/systemd/ContainerInterface.mdwn
index 9fdabb82..17d33e46 100644
--- a/Software/systemd/ContainerInterface.mdwn
+++ b/Software/systemd/ContainerInterface.mdwn
@@ -54,6 +54,6 @@ With user namespacing in place things get much better. With user namespaces the
Or in other words: don't pretend you could lock things down properly right now, with just namespaces, and keep things generic enough. Sorry.
## Final Words
-If you write software that wants to detect whether it is run in a container, please check /proc/1/environ and look for the container= environment variable. Do not assume the environment variable is inherited down the process tree. It generally is not. Hence check the environment block of PID 1, not your own.
+If you write software that wants to detect whether it is run in a container, please check /proc/1/environ and look for the container= environment variable. Do not assume the environment variable is inherited down the process tree. It generally is not. Hence check the environment block of PID 1, not your own. Note though that that file is only accessible to root. systemd hence early on also copies the value into /run/systemd/container, which is readable for everybody. However, that's a systemd-specific interface and other init systems are unlikely to do the same.
Note that it is our intention to make systemd systems work flawlessly and out-of-the-box in containers. In fact we are interested to ensure that the same OS image can be booted on a bare system, in a VM and in a container, and behave correctly each time. If you notice that some component in systemd does not work in a container as it should please contact us.