ContainerNetwork-AutoFix

ContainerNetwork-AutoFix

Docker 应用程序 from ProphetSe7en's Repository

概述

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

运行时参数

网络
bridge
外壳
sh
特权
false
额外参数
--restart=unless-stopped -v /var/run/docker.sock:/var/run/docker.sock -v /boot/config/plugins/dockerMan/templates-user:/templates:ro

模板配置

AppDataPathrw

Optional: Persistent storage for logs

目标
/var/log
默认值
/mnt/user/appdata/containernetwork-autofix
价值
/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.

目标
MASTER_CONTAINER
默认值
vpn-gateway|GluetunVPN|OpenVPN-Client|WireGuard|NordVPN|binhex-delugevpn|binhex-qbittorrentvpn
价值
vpn-gateway
Restart Wait TimeVariable

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

目标
RESTART_WAIT_TIME
默认值
15
价值
15
Max Log LinesVariable

Maximum number of log lines to keep (automatic rotation)

目标
MAX_LOG_LINES
默认值
1000
价值
1000
Max RetriesVariable

Number of times to retry finding master container on startup

目标
MAX_RETRIES
默认值
10
价值
10
Retry DelayVariable

Seconds between retry attempts when finding master container

目标
RETRY_DELAY
默认值
10
价值
10

详细信息

存储库
ghcr.io/prophetse7en/containernetwork-autofix:latest
最后更新2026-05-31
初见2026-04-08

在Unraid 上运行 ContainerNetwork-AutoFix 。

ContainerNetwork-AutoFix 已被列入Unraid OS 的社区应用程序。探索Unraid ,构建灵活的家庭服务器、NAS 或家庭实验室。