The Sidecar That Never Came Back: `restart: no` Behind Gluetun

· 5 min read · Engineering dockergluetunrestart-policycontainer-lifecycleprometheuscadvisormonitoringopenvpn

The Container That Was Not Running

The question arrived as a suspicion, not a report: is Resilio Sync not running? The honest answer took one command, and it was worse than the question implied.

$ docker ps -a --filter name=resilio --format '{{.Names}}\t{{.Status}}'
gluetun-resilio-sync    Exited (137) 3 days ago

Not stopped. Killed — 137 is 128 + 9, SIGKILL, the one signal a process cannot catch — three days earlier — 2026-11-18 23:25 local time. The mount points were intact, the config was intact, and nothing had been synchronising since.

The stack is a VPN egress plus five services that borrow its network namespace. The snippet below is an excerpt — image and build are omitted, and only the relevant lines are shown:

services:
  gluetun:
    restart: unless-stopped        # the only one with a policy
  resilio-sync:
    network_mode: "service:gluetun"
    restart: "no"                  # ← the other four look like this
  downloader-a:
    network_mode: "service:gluetun"
    restart: "no"

Every container in that list has a hard lifetime dependency on gluetun — it cannot start before the namespace exists — and every one of them was configured to never come back on its own.

Four Sidecars Came Back; One Stayed Exited (137)

Four of the five came back, and that is part of why this stayed invisible: the stack was not down, so nothing looked down.

What separated those four from Resilio Sync was timing and state. The downloaders were still running, and they restarted with gluetun five hours before I looked. gluetun-resilio-sync had already been killed with exit code 137 three days earlier. With restart: "no", Docker had no instruction to bring it back, and nothing did.

The mechanics underneath are simple: a container with network_mode: service:X gets its network namespace from X at start time, so its lifetime is tied to X’s existence — but whether it comes back after exiting is still a per-container decision.

Policy on gluetunPolicy on sidecarWhat happens when the sidecar exits
unless-stoppedrestart: "no"stays dead until a human notices
unless-stoppedunless-stoppedDocker restarts it against the existing gluetun container (if gluetun was recreated, the sidecar must also be recreated to bind the new namespace)

The restart I did was one command and it came back clean: Up 25 minutes, RestartCount 0, TLS-PSK handshakes and peer negotiation in the log, both mounts (/volume2/Download/sync, /volume1/Private) unchanged.

One thing I did not establish, and am not going to pretend otherwise: why it was SIGKILLed in the first place. Exited (137) is either an OOM kill or an external SIGKILL, and the distinction matters — a policy that restarts an OOM victim every few minutes turns a memory problem into a churn problem. Checking dmesg and the container’s OOMKilled field is the measurement that turns this from “restarted it” into “fixed it”, and it is still outstanding.

There is a second lifecycle trap in the same configuration: after a recreate of gluetun (not a restart), a sidecar can be Up while its network namespace belongs to a container that no longer exists. The container looks alive, has no egress, and never trips a restart. The test is not docker ps; it is asking the sidecar to resolve a name through the tunnel.

The Monitor That Was Also Dark

The same session surfaced a second failure: cadvisor-vps, a scrape target that had been reporting up=0 since 09:26 UTC — eight hours.

The tunnel was still passing small scrapes: vps-host, on the same link, stayed up=1 the whole time. What had stopped fitting through it was the payload:

BeforeAfter
Payload8.2 MB (originally 20.7 MB)577 KB, 30 KB gzipped
Series4,9122,106
Scrape time~35 s per scrape, frequently past the 50 s timeout3.2 – 4.4 s

The cause was label inflation: every series carried 15+ container_label_* entries, about 3.9 KB per series. On a LAN that is merely wasteful; across a tunnel then seeing 20-25% packet loss, 240 ms round trips and a host with 57% CPU steal, 3.9 KB per series is the difference between a scrape that finishes inside the timeout and one that does not.

The fix, in the cAdvisor command line:

command:
  - --docker_only=true
  - --store_container_labels=false
  - --whitelisted_container_labels=com.docker.compose.project
  - --disable_metrics=...   # disable all metric sets except cpu, memory, network
  - --housekeeping_interval=15s

The --disable_metrics value is elided rather than guessed: the effect I verified was that only cpu, memory and network metric sets stayed enabled. Only com.docker.compose.project was kept on the container-label whitelist.

Acceptance was three consecutive scrapes at up=1 — 3.20 s, 3.73 s, 4.44 s — returning 2,012 samples across 42 containers.

Current State and Open Checks

One dead container and one blind exporter, caught in the same session. Resilio Sync stayed dead for three days and cadvisor-vps stayed dark for eight hours for the same reason: the checks I relied on only proved that the stack and the link were partially alive.

🛡️ Production Infrastructure & SRE

Dealing with flaky containers, cloud cost bloat, or unexplained outages?

Real production reliability comes from understanding the kernel and the protocol layers, not just restarting containers. I manage 162 containers across 3 hosts running 24/7 client workloads.

Lee Teong Hoe

Lee Teong Hoe · Mr Hoelee

Full-stack developer & DevOps engineer based in Malaysia. I run my own production infrastructure and build web systems for small businesses — this blog is the living record.

Hiring? Profile & stack · Malaysian SME? Website design & development ↗ · All posts