Pihole and Unbound on 2 dockers

54 Views Asked by At

I am trying to use pihole and unbound in 2 separate containers but I miss the knowledge on docker connectivity needed to do it apparently. I have looked online but could not find a solution. All this is hosted on a raspberry pi

The following is my docker-compose file

version: '3.6'
networks:
    piguard-network:
    pibound-network:

services:
    duckdns:
        container_name: duckdns
        build: https://github.com/ukkopahis/docker-duckdns.git
    restart: unless-stopped
    environment:
        PUID: 1000
        PGID: 1000
        # Required variables, define here on in docker-compose.override.yml
        TOKEN: [...]
        SUBDOMAINS:  [...]
    # Optional
    # PRIVATE_SUBDOMAINS: your domain added to duckdns.org (without .duckdns.org)
    networks:
        - pibound-network

    pihole:
        container_name: pihole
        image: pihole/pihole:latest
        ports:
            - "8089:80/tcp"
            - "53:53/tcp"
            - "53:53/udp"
            - "67:67/udp"
        environment:
            - TZ=${TZ:-Etc/UTC}
            - WEBPASSWORD=
            # see https://sensorsiot.github.io/IOTstack/Containers/Pi-hole/#adminPassword
            - INTERFACE=eth0
            - FTLCONF_MAXDBDAYS=365
            - PIHOLE_DNS_=8.8.8.8;8.8.4.4
        # see https://github.com/pi-hole/docker-pi-hole#environment-variables
        volumes:
            - ./volumes/pihole/etc-pihole:/etc/pihole
            - ./volumes/pihole/etc-dnsmasq.d:/etc/dnsmasq.d
        dns:
            - 127.0.0.1
            - 1.1.1.1
        cap_add:
            - NET_ADMIN
        restart: unless-stopped
        networks:
            - pibound-network
            - piguard-network
    
    wireguard:
        container_name: wireguard
        image: ghcr.io/linuxserver/wireguard
        restart: unless-stopped
        depends_on:
            - pihole
        ports:
            - "51820:51820/udp"
        environment:
            - PUID=1000
            - PGID=1000
            - TZ=${TZ:-Etc/UTC}
            - SERVERURL= []
            - SERVERPORT=51820
            - PEERS= []
            - PEERDNS=auto
            - ALLOWEDIPS=0.0.0.0/0
        volumes:
            - ./volumes/wireguard/config:/config
            - ./volumes/wireguard/custom-cont-init.d:/custom-cont-init.d
            - ./volumes/wireguard/custom-services.d:/custom-services.d
        cap_add:
            - NET_ADMIN
        sysctls:
            - net.ipv4.conf.all.src_valid_mark=1
        networks:
            - piguard-network

    portainer-ce:
        container_name: portainer-ce
        image: portainer/portainer-ce
        restart: unless-stopped
        ports:
            - "8000:8000"
            - "9000:9000"
        # HTTPS
            - "9443:9443"
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock
            - ./volumes/portainer-ce/data:/data
    
    unbound:
        container_name: unbound
        image: crazymax/unbound
        restart: unless-stopped
        ports:
            - "5053:5053/tcp"
            - "5053:5053/udp"
        environment:
            - TZ=${TZ:-Etc/UTC}
        volumes:
            - ./volumes/unbound/config:/opt/unbound/etc/unbound
        networks:
            - pibound-network

How can i use unbound as the upstream dns server for pihole? I have tried in the pihole interface settings to specify as personalized ip "rapsberry_ip#unbound_port" and "unbound_container_ip" but websites don't load

0

There are 0 best solutions below