Fixed a bug on container stop
This commit is contained in:
parent
a8d70c0fcc
commit
1e96db458d
|
|
@ -5,7 +5,7 @@ RUN mkdir /hoster
|
||||||
WORKDIR /hoster
|
WORKDIR /hoster
|
||||||
ADD hoster.py /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
|
#listen for events to keep the hosts file updated
|
||||||
for e in events:
|
for e in events:
|
||||||
|
status = e["status"];
|
||||||
if e["status"]=="start":
|
if status =="start":
|
||||||
container_id = e["id"]
|
container_id = e["id"]
|
||||||
container = get_container_data(docker, container_id)
|
container = get_container_data(docker, container_id)
|
||||||
hosts[container_id] = container
|
hosts[container_id] = container
|
||||||
update_hosts_file()
|
update_hosts_file()
|
||||||
|
|
||||||
if e["status"]=="stop":
|
if status=="stop" or status=="die" or status=="destroy":
|
||||||
container_id = e["id"]
|
container_id = e["id"]
|
||||||
|
if container_id in hosts:
|
||||||
hosts.pop(container_id)
|
hosts.pop(container_id)
|
||||||
update_hosts_file()
|
update_hosts_file()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue