Fixed a bug on container stop
This commit is contained in:
parent
a8d70c0fcc
commit
1e96db458d
|
|
@ -5,7 +5,7 @@ RUN mkdir /hoster
|
|||
WORKDIR /hoster
|
||||
ADD hoster.py /hoster/
|
||||
|
||||
CMD ["python3", "hoster.py"]
|
||||
CMD ["python3", "-u", "hoster.py"]
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue