#!/bin/bash # Urutau: rewrites containers.map as soon as Docker attaches a container to a # network, so a redeploy that swaps addresses between containers is not judged # with the old names until the next minute of the timer. set -u docker events --filter type=network --filter event=connect --filter type=container --filter event=start --format '{{.Type}}' | while read -r _; do /usr/local/sbin/urutau-containers-map || true # a stack redeploy fires dozens of events: drain the burst, then refresh once more n=0 while read -r -t 1 _; do n=$((n + 1)); done [ "$n" -gt 0 ] && { /usr/local/sbin/urutau-containers-map || true; } done