From f7d20cef7d66fda379c69057b947b52f85d5f193 Mon Sep 17 00:00:00 2001 From: Scott Salisbury Date: Thu, 21 Mar 2019 17:03:07 +0000 Subject: [PATCH] Added config option to specific whether or not to remove the dockerenv and dockerinit files --- pyentrypoint/command.py | 3 ++- pyentrypoint/config.py | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) mode change 100644 => 100755 pyentrypoint/command.py mode change 100644 => 100755 pyentrypoint/config.py diff --git a/pyentrypoint/command.py b/pyentrypoint/command.py old mode 100644 new mode 100755 index 7c1c5c4..e0f747b --- a/pyentrypoint/command.py +++ b/pyentrypoint/command.py @@ -99,7 +99,8 @@ class Command(object): def run(self): if not self.is_handled: self._exec() - self._rm_dockerenv() + if self.config.remove_dockerenv: + self._rm_dockerenv() if os.getuid() is 0: os.setgid(self.config.group) os.setuid(self.config.user) diff --git a/pyentrypoint/config.py b/pyentrypoint/config.py old mode 100644 new mode 100755 index 1cc8523..c20f285 --- a/pyentrypoint/config.py +++ b/pyentrypoint/config.py @@ -226,6 +226,13 @@ class Config(ConfigMeta): return bool(self._config['clean_env']) return True + @property + def remove_dockerenv(self): + """Remove dockerenv and dockerinit files""" + if 'remove_dockerenv' in self._config: + return bool(self._config['remove_dockerenv']) + return True + @property def debug(self): """Enable debug logs."""