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
3 changed files with 7 additions and 4 deletions

View File

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

View File

@ -19,12 +19,12 @@ Hoster provides by default the entries `<container name>, <hostname>, <container
For example, the following container would be available via DNS as `myname`, `myhostname`, `et54rfgt567` and `myserver.com`:
docker run --restart=unless-stopped -d \
docker run -d \
--name myname \
--hostname myhostname \
--network somenetwork --network-alias "myserver.com" \
mycontainer
If you need more features like **systemd integration** and **dns forwarding** please check [resolvable](https://hub.docker.com/r/mgood/resolvable/)
If you need more features like **systemd interation** and **dns forwarding** please check [resolvable](https://hub.docker.com/r/mgood/resolvable/)
Any contribution is, of course, welcome. :)

View File

@ -62,6 +62,8 @@ def get_container_data(dockerClient, container_id):
container_hostname = info["Config"]["Hostname"]
container_name = info["Name"].strip("/")
container_ip = info["NetworkSettings"]["IPAddress"]
if info["Config"]["Domainname"]:
container_hostname = container_hostname + "." + info["Config"]["Domainname"]
result = []
@ -104,7 +106,8 @@ def update_hosts_file():
break;
#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
if len(hosts)>0: