Random, high response times on containers across identical Linux hosts

I asked about Portainer only because recently we had multiple reports about Portainer somehow breaking the network of Docker containers by duplicating mac addresses. Your issue seems different, but if you created anything from Portainer in your current environment, you could still check it.

After those reports came we both tried to write a script with @meyay that helps detecting duplicate mac addresses and this is what I made which I wanted to publish but haven’t done it yet.

#!/usr/bin/env bash

set -eu -o pipefail

network_name="${1:-}"

if [[ -z "$network_name" ]]; then
   mapfile -t network_names < <(docker network ls --format '{{ .Name }}')
else
  network_names=("$network_name")
fi

for inet in "${network_names[@]}"; do
  docker network inspect --format json "$inet" \
    | jq '.[0] | .Containers[] + {"Network": (.Name)} | select(.MacAddress != "") | {(.MacAddress): .}' \
    | jq -s 'reduce .[] as $item ({}; .[$item | keys_unsorted[0]] += [$item[$item | keys_unsorted[0]]])' \
    | jq '[. | to_entries[] | select(.value | length > 1)] | from_entries | select(. != {})'
done

You could save it as docker-duplicate-mac-detector.sh, make it executable and run it without arguments to find duplicate IPs in all networks or run it with a network name ass the only argument to detect duplicate mac only in that network.

The output is a json containing the problematic containers’ name, mac address, IP and network name.

But the previous issues were about containers communicating with eachother on the same network not another container on another host.