diff --git a/Changelog.md b/Changelog.md index 9bcc822..ec440e3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,7 @@ +## 0.9.17 (not yet released) + + * `my_init` no longer reads from and writes to `/etc/container_environment` if that directory does not exist. Previously it would abort with an error. This change makes it easier to reuse `my_init` in other (non-Baseimage-docker-based) projects without having to modify it. + ## 0.9.16 (release date: 2015-01-20) * `docker exec` is now the default and recommended mechanism for running commands in the container. SSH is now disabled by default, but is still supported for those cases where "docker exec" is not appropriate. Closes GH-168. diff --git a/image/bin/my_init b/image/bin/my_init index 0502c6a..2549388 100755 --- a/image/bin/my_init +++ b/image/bin/my_init @@ -57,6 +57,8 @@ def is_exe(path): return False def import_envvars(clear_existing_environment = True, override_existing_environment = True): + if not os.path.exists("/etc/container_environment"): + return new_env = {} for envfile in listdir("/etc/container_environment"): name = os.path.basename(envfile) @@ -73,6 +75,8 @@ def import_envvars(clear_existing_environment = True, override_existing_environm os.environ[name] = value def export_envvars(to_dir = True): + if not os.path.exists("/etc/container_environment"): + return shell_dump = "" for name, value in os.environ.items(): if name in ['HOME', 'USER', 'GROUP', 'UID', 'GID', 'SHELL']: