1
0
mirror of /repos/baseimage-docker.git synced 2025-12-30 08:01:31 +01:00

my_init: do not use /etc/container_environment if directory doesn't exist

This commit is contained in:
Hongli Lai (Phusion) 2015-07-15 14:33:15 +02:00
parent 9e65ebfbdc
commit e575443aba
No known key found for this signature in database
GPG Key ID: 2AF96EB85EF4DA0D
2 changed files with 8 additions and 0 deletions

View File

@ -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.

View File

@ -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']: