diff --git a/CHANGELOG.md b/CHANGELOG.md index 921967c8..67d36f68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 0.1.5 + - fix bug with host network + ## 0.1.4 - Add run cmd arguments when it's a single process image - Remove bash from command when it's a single process image diff --git a/Makefile b/Makefile index 4ad7b43d..2e2e3677 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ NAME = osixia/light-baseimage -VERSION = 0.1.4 +VERSION = 0.1.5 .PHONY: all build test tag_latest release build-tool diff --git a/image/tool/my_init b/image/tool/my_init index c194461f..53a5ef64 100755 --- a/image/tool/my_init +++ b/image/tool/my_init @@ -64,16 +64,18 @@ def xstr(s): return str(s) def set_env_hostname_to_etc_hosts(): + try: + if "HOSTNAME" in os.environ: + with open('/etc/hostname', 'r') as f: + etc_hostname = f.readline().rstrip() - if "HOSTNAME" in os.environ: - with open('/etc/hostname', 'r') as f: - etc_hostname = f.readline().rstrip() - - ip_address = socket.gethostbyname(etc_hostname) + ip_address = socket.gethostbyname(etc_hostname) - if os.environ["HOSTNAME"] != etc_hostname: - with open("/etc/hosts", "a") as myfile: - myfile.write(ip_address+" "+os.environ["HOSTNAME"]+"\n") + if os.environ["HOSTNAME"] != etc_hostname: + with open("/etc/hosts", "a") as myfile: + myfile.write(ip_address+" "+os.environ["HOSTNAME"]+"\n") + except: + pass def python_dict_to_bash_envvar(name, python_dict):