October 17, 2025Oct 17 ContainerNetwork AutoFix (CNAF)Automatically recreates Docker containers when their master container restarts.The ProblemWhen using Docker's --net=container: networking (common with VPN containers), dependent containers reference the master container by its ID. When the master container restarts or updates, it gets a new container ID, breaking the network connection for all dependent containers.Example: You have containers routing through GluetunVPN. When GluetunVPN updates and restarts, your dependent containers (qBittorrent, Prowlarr, etc.) lose network connectivity and need to be manually recreated.The SolutionCNAF monitors your master container (VPN, etc.) and automatically recreates any dependent containers when it restarts, restoring their network connectivity.Features✅ Zero configuration - Automatically detects dependent containers✅ State preservation - Maintains running/stopped state of containers✅ Smart waiting - Configurable delay for VPN establishment✅ Log rotation - Automatic log management✅ Standalone - No dependencies on Unraid scripts✅ Universal - Works with any master container (GluetunVPN, OpenVPN-Client, WireGuard, etc.)InstallationFrom Community Apps (Recommended)Open Community AppsSearch for "ContainerNetwork AutoFix" or "CNAF"Click InstallConfigure the master container name (default: GluetunVPN)ApplyManual Installationbashdocker run -d \ --name='ContainerNetwork-AutoFix' \ --restart=unless-stopped \ -e MASTER_CONTAINER='GluetunVPN' \ -e RESTART_WAIT_TIME='15' \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /boot/config/plugins/dockerMan/templates-user:/templates:ro \ -v /mnt/user/appdata/containernetwork-autofix:/var/log \ buxxdev/containernetwork-autofix:latest ```## Configuration| Variable | Default | Description ||----------|---------|-------------|| `MASTER_CONTAINER` | `GluetunVPN` | Name of the master container to monitor || `RESTART_WAIT_TIME` | `15` | Seconds to wait after master restarts (allows VPN to establish) || `MAX_LOG_LINES` | `1000` | Maximum log lines (automatic rotation) || `MAX_RETRIES` | `10` | Startup retry attempts for finding master container || `RETRY_DELAY` | `10` | Seconds between retry attempts |## How It Works1. CNAF starts and waits for your master container to be ready 2. Detects all containers using the master container's network 3. Monitors Docker events for master container restarts 4. When the master restarts: - Waits for configured time (VPN establishment) - Identifies containers using the old master container ID - Records each container's state (running/stopped) - Stops and removes broken containers - Recreates from Unraid templates - Restores original state ## Common Use Cases### VPN Containers- **GluetunVPN** (most common)- OpenVPN-Client - WireGuard - NordVPN - binhex-delugevpn - Any VPN container using `--net=container:`### Example Setup``` GluetunVPN (master container)├── qBittorrent (--net=container:GluetunVPN)├── Prowlarr (--net=container:GluetunVPN)└── slskd (--net=container:GluetunVPN)When GluetunVPN restarts, CNAF automatically recreates qBittorrent, Prowlarr, and slskd.TroubleshootingContainer not being recreatedCheck the logs:bashdocker logs ContainerNetwork-AutoFixVerify the container uses container networking:bashdocker inspect YOUR_CONTAINER | grep NetworkModeShould show: "NetworkMode": "container:MASTER_CONTAINER_ID""Master container not found"Ensure the master container name matches exactly (case-sensitive)Check the master container is runningIncrease MAX_RETRIES or RETRY_DELAY if the master takes time to start"Template not found"CNAF requires Unraid container templates to recreate containersEnsure containers were created through Unraid GUI (not manually via docker run)LinksGitHub: https://github.com/buxxdev/containernetwork-autofixDocker Hub: https://hub.docker.com/r/buxxdev/containernetwork-autofixDocumentation: https://github.com/buxxdev/containernetwork-autofix/blob/main/README.mdSupportPost questions or issues in this thread. Include:CNAF logs: docker logs ContainerNetwork-AutoFixMaster container nameAffected container namesUnraid versionChangelogv1.0.0 (2025-10-17)Initial releaseAuto-detection of dependent containersState preservationLog rotationUnraid template parsing
October 24, 2025Oct 24 Author I’ve sent a message to @squid to advise is anything is pending for it to be added
November 5, 2025Nov 5 Thank you for this! It's been annoying me for a while, great to have a solution for it.Edit: Would just like to add - It ran today and worked perfectly! Edited November 6, 2025Nov 6 by Stabster
November 5, 2025Nov 5 Don't know what i am doing wrong. But can't make it work. Tried to increase the wait time but same result.root@Tower:~# docker inspect bitmagnet | grep NetworkMode"NetworkMode": "container:fcb9943f24baebb96e2236fc9c941ce18719cb9e7931c09f3285784aade15d11",root@Tower:~#2025-11-05 23:53:52: Parsing template for bitmagnet...2025-11-05 23:53:52: Repository: binhex/arch-bitmagnet:latest2025-11-05 23:53:52: Network: none2025-11-05 23:53:52: Docker command: docker run -d --name='bitmagnet' -l net.unraid.docker.managed=dockerman -l net.unraid.docker.icon='' --net='none' -v '/mnt/cache/appdata/binhex-bitmagnet':'/config':'rw' -e 'TMDB_API_KEY'='xxxxxxxxx' -e 'SHARED_NETWORK'='no' -v 'binhex-shared':'/shared':'rw' -e 'PUID'='99' -e 'PGID'='100' -e 'UMASK'='000' --network=container:GluetunVPN 'binhex/arch-bitmagnet:latest'2025-11-05 23:53:52: Executing docker run...f98f438f4d8b7bef20f6f95d3e62ce4752eadb7a4b1190447cd7965dd32f3d3ddocker: Error response from daemon: network container:GluetunVPN not foundRun 'docker run --help' for more information2025-11-05 23:53:52: ✗ ERROR: Failed to recreate bitmagnet2025-11-05 23:53:52: All dependent containers processed.Master container name : GluetunVPNAffected container names: bitmagnetUnraid version: 7.2.0
November 15, 2025Nov 15 On 11/5/2025 at 6:57 PM, sbxx said:Don't know what i am doing wrong. But can't make it work. Tried to increase the wait time but same result.I've had the exact same experience as sbxx. My logs look the same too. The only additional thing I tried was to wrap the network value in quotes: --network='container:GluetunVPN'Edit: I just figured it out. @sbxx - Use the network dropdown and select "Container". You and I are doing it the old way. Edited November 15, 2025Nov 15 by Tony Tamplin
November 15, 2025Nov 15 Hey, thank you for this great App.Is there any Chance that it will support Containers from the Docker Compose Plugin in a future Update?
November 16, 2025Nov 16 Author On 11/15/2025 at 10:37 AM, Tony Tamplin said:I've had the exact same experience as sbxx. My logs look the same too. The only additional thing I tried was to wrap the network value in quotes: --network='container:GluetunVPN'Edit: I just figured it out. @sbxx - Use the network dropdown and select "Container". You and I are doing it the old way.Hi guys, sorry for the delay coming back @Tony Tamplin is correct, I built it only to work with the dropdown approach for Container Network.Thanks for working out the issue before I even had chance to look into it!
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.