Handle container rename

This commit is contained in:
Aurele Oules 2023-10-23 23:27:47 +02:00
parent 581f5c1e66
commit eb55a805b4
1 changed files with 7 additions and 0 deletions

View File

@ -55,6 +55,13 @@ def main():
hosts.pop(container_id) hosts.pop(container_id)
update_hosts_file() update_hosts_file()
if status=="rename":
container_id = e["id"]
if container_id in hosts:
container = get_container_data(dockerClient, container_id)
hosts[container_id] = container
update_hosts_file()
def get_container_data(dockerClient, container_id): def get_container_data(dockerClient, container_id):
#extract all the info with the docker api #extract all the info with the docker api