Sign inSign up

eafxx/rebuild-dndc

By eafxx

Updated about 1 month ago

Rebuild Docker Net Dependent Containers, i.e. Monitor a VPN container & rebuild dependent containers

Image
3

100K+

eafxx/rebuild-dndc repository overview

eafxx/rebuild-dndc

Re-create containers that use another container's network stack (e.g. routing container traffic through a VPN container).

  • RDNDC will monitor the master container during container re-creation/updates/reboots/host reboots and rebuilds dependent containers using the master container's network stack.
  • Any containers using the master container network stack will be auto added to the watch list.
  • Monitor master container's WAN connectivity, reboots master container if network is down.
  • Only supported on unRAID at the moment.

Prerequisites

  1. Make sure the master container (e.g. vpn container) is up & running as expected.
  2. Create a docker network named container:master_container_name , to do that, do the following: open terminal > docker network create container:master_container_name note: master container name should be all lower case, rename your container if it isn't.
  3. Now edit a container you want to add to the master container network stack
  4. You should see the created network (step 2) under 'network type', select that & click 'apply'.

image

OR

Alternate steps

  1. Edit a container you want to add to the master container network stack,
  2. Add --net=container:master_container_name in extra parameters and
  3. click 'apply'

Docker

Tags

TagDescriptionBuild Status
unraid-mUnraid stableDocker Build Master
unraid-dUnraid development, pre-releaseDocker Build Dev
unraid-eUnraid experimental, unstableDocker Build Exp

Community Applications (unRAID) - recommended

  1. Open the 'Apps' tab and
  2. Search for 'rebuild-dndc'
  3. Click on the Install button

ca

Docker Run

docker run -d --name='Rebuild-DNDC' --net='bridge' -e TZ="Europe/London" -e HOST_OS="Unraid" -e 'mastercontname'='vpn' -e 'mastercontconcheck'='yes' -e 'ping_ip'='1.1.1.1' -e 'ping_ip_alt'='8.8.8.8' -e 'ping_count'='4' -e 'sleep_secs'='10' -e 'run_startup'='yes' -e 'discord_notifications'='yes' -e 'discord_url'='https://discordapp.com/api/webhooks/xxxxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxx' -e 'cron'='*/5 * * * *' -v '/var/run/docker.sock':'/var/run/docker.sock':'rw' -v '/boot/config/plugins/dockerMan/templates-user':'/config/docker-templates':'ro' -v '/mnt/appdata/rebuild-dndc/config/rebuild-dndc':'/config/rebuild-dndc':'rw' 'eafxx/rebuild-dndc:unraid-m' 

- Parameters

Container images are configured using parameters passed at runtime (such as those above).

ParameterFunction
-e mastercontname=vpnMaster container name, replace this with your master container name
-e mastercontconcheck=yesCheck for master container connectivity & reboot container if no connectivity [yes/no]
-e ping_count=4Number of times you want to ping the ping_ip before the script restarts the master container due to no connectivity, lower number might be too aggressive - default 4
-e ping_ip=1.1.1.1Default ping IP to check master container connectivity
-e ping_ip_alt=8.8.8.8Secondary ping IP to check master container connectivity (optional)
-e sleep_secs=10Time to wait until the master container has completely booted up - default 10s
-e cron=*/5 * * * *Cron schedule set to run every 5mins - default 5mins
-e run_startup=yesDo a first run immediately without waiting [yes/no]
-e discord_notifications=yesEnable Discord notifications [yes/no]
-e gotify_notifications=yesEnable Gotify notifications [yes/no]
-e discord_urlFull Discord webhook URL, only required if notifications are enabled
-e gotify_urlFull Gotify server message URL + token, only required if notifications are enabled
-v /config/docker-templatesPath to user docker templates on Unraid (read-only)
-v /var/run/docker.sockDocker-daemon socket location
-v /config/rebuild-dndcContains container monitor list.
-e TZ=Europe/LondonSpecify a timezone to use e.g. Europe/London
- Additional Optional Parameters
ParameterFunction
-e cont_list=ContainerA ContainerBSpecify a list of containers that you can manually rebuild on demand using the rebuildm -b & rebuildm -f commands (see below). Container names are case sensitive & leave space between each container name.
-e save_no_mcontids=20Default set to 20, maintains a list of last 20 master containerIDs when the container is destroyed or re-created. Makes sure containers using the master container network aren't orphaned and marked for re-creation.
- Port Forwarding Optional Parameters
Supported Apps
  • ruTorrent
Requirements
ParameterFunction
-e rutorrent_cont_name=ruTorrentruTorrent container name (case sensitive)
-e rutorrent_pf=yesEnable ruTorrent Port Forwarding
-v /app/pf/rutorrent/Path to ruTorrent rtorrent.rc or .rtorrent.rc file without specifying file name
- Create dependent containers manually

If for some reason master container dependent containers have failed to be created, you can start several containers using a single command, which is far more convenient than doing it through the unRAID GUI.

Interactive Shell

docker exec -it Rebuild-DNDC bash -c 'rebuildm -b container01 container02 container03'

docker exec -it Rebuild-DNDC bash -c 'rebuildm -f container01 container02 container03'

docker exec -it Rebuild-DNDC bash -c 'rebuildm -b $cont_list'

docker exec -it Rebuild-DNDC bash -c 'rebuildm -f $cont_list'

OR

SSH onto Rebuild-DNDC container

rebuildm -b container01 container02 container03

rebuildm -f container01 container02 container03

rebuildm -b $cont_list

rebuildm -f $cont_list

  • Replace containerXX with the actual containers you want to create (case-sensitive).
  • Manual run is not limited to containers dependent on master container network. As long as the docker template for that container exists, it will create the container.
  • -b : Attempts a container rebuild only, if that container already exists, rebuild will be skipped.
  • -f : Stop/remove and rebuild containers if it exists or not.
  • $cont_list : List of containers that need to rebuild.

You can use any VPN image you want but the following is recommended and ruTorrent port forwarding with RDNDC is supported with the following image (PIA only!)

qmcgaw/gluetun [Supports PIA, Mullvad, Windscribe and others ]

Credits

  • ParseDockerTemplate.sh: author unRAID forum member: skidelo; contributors: Alex R. Berg and eafx; source

  • Discord notifications: Discord.sh; source: source

  • Logo: based on the icon made by Pause08 from www.flaticon.com

Tag summary

Content type

Image

Digest

sha256:e6edb4c79

Size

96.1 MB

Last updated

about 1 month ago

docker pull eafxx/rebuild-dndc:unraid-m-6.9.2-a2e24902