April 29, 20242 yr Hi all, I'm not sure this is the right part of the forum to post, so mod, please move in case you find a more suitable place. I just wanted to share my solution on the topic which I hope can help someone else! My problem: I want to utilize a container with a VPN client as a docker network, to enable chosen containers to always be connected through the VPN connection. I tried all possible solutions found here and other places to make this work over time, but I always ended up having problems with having to manually restart these containers. I've tried the Rebuild-DNDC container on multiple occassions, but as it's primarily made to be use in combination with gluetun, and I unfortunately didn't get it to catch soft failures of containers properly. Solution: I put my (very) limited code production skills to use with the help of AI and created a bash script to be used with a cronjob with the User Scripts plugin. I wanted to share my now (for me) confirmed working solution as it's been running for two weeks straight without any hiccups. You can find the script here: https://github.com/sebstrgg/unraid-restart-vpn-containers I'm open to any suggestions, feedbacks, pull requests etc. to make the script more user friendly and resilient. There might be obvious sub-optimizations as I don't have that much skill in coding overall and AI made a majority of the code with a lot of revisions through prompts from my part. Edited April 29, 20242 yr by sebstrgg typo
April 30, 20242 yr Community Expert Interesting script. Reviewing your code: https://github.com/sebstrgg/unraid-restart-vpn-containers/blob/main/unraid-restart-vpn-containers.sh I think this would have been better under https://forums.unraid.net/forum/47-docker-containers/ or https://forums.unraid.net/forum/58-docker-engine/ Other Thoughts: so? why not use a docker network create command to use the vpn interface? or vpn setting allow ip address to the docker? Edited April 30, 20242 yr by bmartino1
May 4, 20242 yr Author On 4/30/2024 at 3:18 AM, bmartino1 said: Interesting script. Reviewing your code: https://github.com/sebstrgg/unraid-restart-vpn-containers/blob/main/unraid-restart-vpn-containers.sh I think this would have been better under https://forums.unraid.net/forum/47-docker-containers/ or https://forums.unraid.net/forum/58-docker-engine/ Other Thoughts: so? why not use a docker network create command to use the vpn interface? or vpn setting allow ip address to the docker? To be able to use a container as the network for other containers, you need to use the 'docker network create container:<container_name>' command as per other guides. No changes there. The problem is that when the VPN container is restarted in some way (connection restarted or container) the containers connected to that network most often drops their connection overall. If the container is restarted it's due to the VPN container (master) changed container ID, leaving the connected containers hanging in wait of a restart. Here you can use the Rebuild-DNDC container to get help to restart the connected containers. The problem I've experienced is that the Rebuild-DNDC not always manages to properly restart the containers, or that when it's been a connection reset of any kind (leaving the master container intact with the same container ID), it fails to recognize this and the connected containers also drop their outbound connection (to the internet). I'm sure Rebuild-DNDC works properly if used with gluetun as it's built for that purpose - but since I don't, this is an annoying problem leaving me to manually restarting the containers. Edited May 4, 20242 yr by sebstrgg typo
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.