docker inspect --format map iteration is non-deterministic
Iterating map-typed fields (like .NetworkSettings.Networks) in docker inspect --format templates.
docker inspect --format uses Go's text/template, and Go intentionally randomizes map iteration order. So {{range $k, $v := .NetworkSettings.Networks}}{{$k}} {{$v.Gateway}}{{end}} over a multi-network container returns rows in a different order each invocation — a script that "picks the first" gets non-deterministic behavior across runs. This bites scripts that auto-discover the bridge gateway of a container attached to multiple networks (e.g. its compose-default plus a shared proxy network like caddy_net or traefik). Fix: enumerate all rows and decide explicitly (sort by name, prefer a network with a known prefix, or let the user override with an env var like REMOTE_BRIDGE_IP). Same hazard applies to .Labels, .Mounts (slice — OK), and any other map traversal in inspect templates.
When writing a docker inspect --format expression that ranges over a map, assume order is random and pick a deterministic field (sort, named lookup, or user override) instead of trusting the first emission.