elmerfds / rebuild-dndc

Re-create containers that use another container's network stack (i.e. routing container traffic through a VPN container)
GNU General Public License v3.0
22 stars 9 forks source link

Fixed xml parse to be compatible with newer unraid version #60

Closed Phil-Barker closed 1 year ago

Phil-Barker commented 1 year ago

The ParseDockerTemplate.sh script was failing to find Volumes, in the new XML format used by latest versions of Unraid.

This also impacts ports and envars as they have moved along with volumes into Config elements

I am no expert bash programmer, but I have made some updates and tested that they work

xxx@XXX:~# ./ParseDockerTemplate.sh -yv /boot/config/plugins/dockerMan/templates-user/my-pihole.xml
Dry-Run: Will not start dockers, just parse xml and build command.
Name: pihole
Found Net:  --net="br0"
Found IP:  --ip="xx.xx.xx.xx"
Found Privilege:  --privileged="true"
Found Environment:  -e PIHOLE_DNS_="1.1.1.1;8.8.8.8;"
Found Environment:  -e TZ="Europe/London"
Found Environment:  -e WEBPASSWORD="xxxxxxxxxxxxx"
Found Environment:  -e INTERFACE="br0"
Found Environment:  -e ServerIP="xx.xx.xx.xx"
Found Environment:  -e ServerIPv6=""
Found Environment:  -e IPv6="False"
Found Environment:  -e DNSMASQ_LISTENING="all"
Found Environment:  -e WEBUIBOXEDLAYOUT="boxed"
Found TimeZone:  -e TZ=""
Found Port:  -p 53:53/tcp
Found Port:  -p 53:53/udp
Found Port:  -p 67:67/udp
Found Port:  -p 7080:80/tcp
Found Port:  -p 7443:443/tcp
Found volume:  -v "/mnt/cache/appdata/pihole/pihole/":"/etc/pihole/":rw
Found volume:  -v "/mnt/user/appdata/pihole/dnsmasq.d/":"/etc/dnsmasq.d/":rw
Found Extra params:  --cap-add=NET_ADMIN --restart=unless-stopped
Found Repo:  pihole/pihole:latest
/usr/bin/docker run -d --name="pihole" --net="br0" --ip="xx.xx.xx.xx" --privileged="true" -e PIHOLE_DNS_="1.1.1.1;8.8.8.8;" -e TZ="Europe/London" -e WEBPASSWORD="xxxxxxxxxxxxx" -e INTERFACE="br0" -e ServerIP="xx.xx.xx.xx" -e ServerIPv6="" -e IPv6="False" -e DNSMASQ_LISTENING="all" -e WEBUIBOXEDLAYOUT="boxed" -e TZ="" -p 53:53/tcp -p 53:53/udp -p 67:67/udp -p 7080:80/tcp -p 7443:443/tcp -v "/mnt/cache/appdata/pihole/pihole/":"/etc/pihole/":rw -v "/mnt/user/appdata/pihole/dnsmasq.d/":"/etc/dnsmasq.d/":rw --cap-add=NET_ADMIN --restart=unless-stopped pihole/pihole:latest

I hope this helps but obviously feel free to change it if there's a nicer way of doing it

elmerfds commented 1 year ago

From a quick look this looks good but can't test it myself just yet.

The only problem I can think of is for users still on an older version of Unraid, need to find a way to use the old version of ParseDockerTemplate.sh

elmerfds commented 1 year ago

Less elegant solution for now, created a new branch for users on the older version of Unraid.

I'll merge your pull request now, thanks for your help