TPTito Pinardo Gutiérrez
← Articles
Español

«Up» and offline: what a Docker restart leaves behind

Every Wednesday the home servers update themselves. This time Docker got bumped: on restart, several containers that reach the internet through another one (a VPN container) started before it and stayed attached to its old network. Still «Up», no internet. And no alert came, because the bridge to my chat had been dead for two weeks.

  • Docker
  • Ansible
  • Linux (Debian, Alpine, Arch)

Fact sheet

Type
Incident
Where it happened
1U · LIBRARY
Impact
The download containers, a day without internet after the automatic update. All of them said «Up».
How I found out
By hand, noticing nothing was downloading. No alert: the thing that should have alerted was down too.
The lesson
«Nothing restarts on its own» was false: apt restarts what it upgrades. After changing something you have to check it, and whatever watches also needs someone watching it.

Symptom

On Thursday morning nothing was downloading. In the Docker panel everything was green: four containers «Up» and the VPN one healthy. From inside any of the four, not a single connection got out.

A fifth container, the one that syncs the VPN port, was stopped with a clear error: it couldn't join a network namespace that no longer existed.

Cause

Those containers have no network of their own: they use the VPN container's, so all their traffic goes through the tunnel. When Docker restarts, the VPN container comes back with a new network namespace, but the ones that had already started stay in the old one, which leads nowhere.

And why did Docker restart? The Wednesday update bumped the Docker package, and apt restarts the service it upgrades. My idea that «packages get upgraded but nothing restarts on its own» was false.

# Do they really share a network? Each process points to its namespace:
for c in vpn descargas; do
  pid=$(docker inspect -f '{{.State.Pid}}' "$c")
  echo "$c $(readlink /proc/$pid/ns/net)"
done
# vpn       net:[4026533120]
# descargas net:[4026532871]   ← different

Why nobody was told

Monitoring only checked whether the containers were running, and they were. And the update summary checked nothing after updating: it said «all good» because apt had finished fine.

Worse: the bridge that carries alerts to my chat had been down since 19 October, after a power cut. It didn't start on its own after the server rebooted. For two weeks no alert arrived: not from CI/CD, not from updates, not from attack blocking. Silence looked like calm.

The fix

  • live-restore in Docker: containers keep running while the service restarts, so a Docker upgrade no longer moves them.
  • A watcher every two minutes: it compares each container's network namespace with the one of the container it depends on. If they differ, it restarts it and posts in the incidents room.
  • The update checks which services and containers were running before and after, and marks with ❌ in the summary whatever didn't come back.
  • The alert bridge starts with the system and restarts itself if it dies.
  • All in Ansible and through a PR, as always. It's already on the four servers running Docker.

Result

Now restarting Docker on purpose leaves no container without a network, and if one ever gets left hanging, the watcher brings it back and tells me.

The part that taught me the most is the silence: an alert system that doesn't tell you it's broken is worse than having none. Now the bridge is watched too.

The lesson

«Nothing restarts on its own» was false: apt restarts what it upgrades. After changing something you have to check it, and whatever watches also needs someone watching it.

Where it happened

Step into the rack unit to see this part from the inside, with its flows and the rest of its failures.

1U · LIBRARY → Get in touch See all articles