ContainerNetwork-AutoFix

ContainerNetwork-AutoFix

Docker app from ProphetSe7en's Repository

Overview

ContainerNetwork AutoFix (CNAF) - Automatically recreates Docker containers that depend on a master container's network when the master container restarts. Perfect for containers routing through VPN containers like GluetunVPN.

This is the ProphetSe7en fork of buxxdev/containernetwork-autofix with the Unraid template parser rewritten using xmlstarlet. The rewrite fixes three bugs in the upstream sed-based parser:

  • Healthchecks broken after rebuild (XML entities not decoded)
  • WebUI right-click broken in Unraid GUI (missing net.Unraid.docker.* labels)
  • Hardware passthrough lost on rebuild (no Device case in parser)

The fork is a drop-in replacement: same env vars, same mounts, same behavior - only the Repository line needs to change.

When a master container (e.g., VPN) restarts and gets a new container ID, dependent containers using --net=container: lose network connectivity. CNAF automatically detects and recreates those dependent containers.

Features:

  • Auto-detects dependent containers
  • Preserves container states (running/stopped)
  • Smart waiting for VPN establishment
  • Automatic log rotation
  • Zero manual configuration needed

Runtime arguments

Network
bridge
Shell
sh
Privileged
false
Extra Params
--restart=unless-stopped -v /var/run/docker.sock:/var/run/docker.sock -v /boot/config/plugins/dockerMan/templates-user:/templates:ro

Template configuration

AppDataPathrw

Optional: Persistent storage for logs

Target
/var/log
Default
/mnt/user/appdata/containernetwork-autofix
Value
/mnt/user/appdata/containernetwork-autofix
Master Container NameVariable

Select your VPN/master container from the dropdown. For custom container names, click EDIT and enter the name in the Value field.

Target
MASTER_CONTAINER
Default
vpn-gateway|GluetunVPN|OpenVPN-Client|WireGuard|NordVPN|binhex-delugevpn|binhex-qbittorrentvpn
Value
vpn-gateway
Restart Wait TimeVariable

Seconds to wait after master container restarts before recreating dependents (allows VPN to establish)

Target
RESTART_WAIT_TIME
Default
15
Value
15
Max Log LinesVariable

Maximum number of log lines to keep (automatic rotation)

Target
MAX_LOG_LINES
Default
1000
Value
1000
Max RetriesVariable

Number of times to retry finding master container on startup

Target
MAX_RETRIES
Default
10
Value
10
Retry DelayVariable

Seconds between retry attempts when finding master container

Target
RETRY_DELAY
Default
10
Value
10

Details

Repository
ghcr.io/prophetse7en/containernetwork-autofix:latest
Last Updated2026-06-01
First Seen2026-04-08

Run ContainerNetwork-AutoFix on Unraid.

ContainerNetwork-AutoFix is listed in Community Apps for Unraid OS. Explore Unraid to build a flexible home server, NAS, or homelab.