Compare commits

...

5 Commits

Author SHA1 Message Date
osiu97 e379c6e8b4 Zaktualizuj 'Dockerfile' 2020-05-29 15:28:03 +02:00
David Darias 581f5c1e66
Merge pull request #7 from pemcconnell-anyvision/develop
Only attempt lines trim if the list isn't empty
2020-04-28 18:26:49 -04:00
Peter McConnell 74fa987b9e Only attempt lines trim if the list isn't empty 2020-04-27 20:26:00 +01:00
David Darias 05231ffae0
Merge pull request #6 from ederuiter/ederuiter-domainname
Append domain name to host name
2020-03-10 10:41:16 -04:00
Eric de Ruiter c0436fd225
Append domain name to host name 2020-03-09 16:48:05 +01:00
2 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,4 @@
FROM frolvlad/alpine-python3 FROM python:3-alpine
RUN pip3 install docker RUN pip3 install docker
RUN mkdir /hoster RUN mkdir /hoster

View File

@ -62,6 +62,8 @@ def get_container_data(dockerClient, container_id):
container_hostname = info["Config"]["Hostname"] container_hostname = info["Config"]["Hostname"]
container_name = info["Name"].strip("/") container_name = info["Name"].strip("/")
container_ip = info["NetworkSettings"]["IPAddress"] container_ip = info["NetworkSettings"]["IPAddress"]
if info["Config"]["Domainname"]:
container_hostname = container_hostname + "." + info["Config"]["Domainname"]
result = [] result = []
@ -104,7 +106,8 @@ def update_hosts_file():
break; break;
#remove all the trailing newlines on the line list #remove all the trailing newlines on the line list
while lines[-1].strip()=="": lines.pop() if lines:
while lines[-1].strip()=="": lines.pop()
#append all the domain lines #append all the domain lines
if len(hosts)>0: if len(hosts)>0: