1
0
mirror of https://github.com/dvddarias/docker-hoster synced 2026-08-05 16:12:43 +02:00

Fixed a bug on container stop

This commit is contained in:
David Darias
2015-11-18 21:24:45 -05:00
parent a8d70c0fcc
commit 1e96db458d
3 changed files with 15 additions and 14 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ RUN mkdir /hoster
WORKDIR /hoster
ADD hoster.py /hoster/
CMD ["python3", "hoster.py"]
CMD ["python3", "-u", "hoster.py"]
+4 -3
View File
@@ -39,15 +39,16 @@ def main():
#listen for events to keep the hosts file updated
for e in events:
if e["status"]=="start":
status = e["status"];
if status =="start":
container_id = e["id"]
container = get_container_data(docker, container_id)
hosts[container_id] = container
update_hosts_file()
if e["status"]=="stop":
if status=="stop" or status=="die" or status=="destroy":
container_id = e["id"]
if container_id in hosts:
hosts.pop(container_id)
update_hosts_file()