Pihole nicht erreichbar wenn network mode angegeben (docker)

Hallo, ich möchte gern pihole mit unbound in Docker laufen lassen. Dies ist meine docker-compose.yml:

version: '2'

volumes:
  pihole:
  dnsmasq:

services:
  pihole:
    image: pihole/pihole:latest
    container_name: pihole
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp" # Only required if you are using Pi-hole as your DHCP server
      - "81:80/tcp"
    cap_add:
      - NET_ADMIN
    environment:
      WEBPASSWORD: ${WEBPASSWORD}
      TZ: 'Europe/Berlin'
    volumes:
      - './etc-pihole:/etc/pihole'
      - './etc-dnsmasq.d:/etc/dnsmasq.d'
    dns:
      - '127.0.0.1'
      - '1.1.1.1'
    network_mode: host
    environment:
      - 'DNS1=127.0.0.1#5053'
      - 'DNS2=127.0.0.1#5053'
    restart: unless-stopped
  unbound:
    image: klutchell/unbound:1.13.2
    ports:
      - '5053:5053/tcp'
      - '5053:5053/udp'
    restart: unless-stopped

Quelle

Sobald ich network_mode: host in der docker-compose habe, kann ich über ip-adresse:81 pihole nicht erreichen. Wenn ich den Eintrag entferne oder auskommentiere, kann ich pihole unter der Adresse ip-adresse:81 erreichen.

Woran liegt das?

Laut Internetz muss wohl bei network_mode die ServerIP separat eingetragen werden. Geht aber auch nicht, gleiches Problem. Sieht aktuell bei mir daher so aus:

version: '2'

volumes:
  pihole:
  dnsmasq:

services:
  pihole:
    image: pihole/pihole:latest
    container_name: pihole
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp" # Only required if you are using Pi-hole as your DHCP server
      - "81:80/tcp"
    cap_add:
      - NET_ADMIN
    environment:
      ServerIP: '192.168.178.34'
      WEBPASSWORD: ${WEBPASSWORD}
      TZ: 'Europe/Berlin'
      DNS1: 127.0.0.1#5335 # Hardcoded to our Unbound server
      DNS2: 127.0.0.1#5335 # Hardcoded to our Unbound server
    volumes:
      - './etc-pihole:/etc/pihole'
      - './etc-dnsmasq.d:/etc/dnsmasq.d'
    dns:
      - '127.0.0.1'
      - '1.1.1.1'
    network_mode: host
    restart: unless-stopped
  unbound:
    image: klutchell/unbound:1.13.2
    ports:
      - '5053:5053/tcp'
      - '5053:5053/udp'
    restart: unless-stopped

In den docs gibt es folgenden Hinweis:

--net=host
Optional Alternative to -p <port>:<port> arguments (Cannot be used at same time as -p) if you don't run any other web application. DHCP runs best with --net=host, otherwise your router must support dhcp-relay settings.

Ok, soweit so klar. network_mode: host geht nur ohne ports. Ist network_mode: host überhaupt die richitge Syntax oder ist es nur network oder gar net?
Pihole muss aber zwingend unter einem anderen Port als 80 laufen. Wie kann ich denn so den Port 81 durchreichen?

Edit:
Ohne meine Frage jetzt selber beantworten zu wollen, aber WEB_PORT scheint wohl genau für sowas gemacht worden zu sein?

version: '2'

volumes:
  pihole:
  dnsmasq:

services:
  pihole:
    image: pihole/pihole:latest
    container_name: pihole
    #ports:
    #  - "53:53/tcp"
    #  - "53:53/udp"
    #  - "67:67/udp" # Only required if you are using Pi-hole as your DHCP server
    #  - "81:80/tcp"
    cap_add:
      - NET_ADMIN
    environment:
      ServerIP: 192.168.178.34
      WEB_PORT: 81
      WEBPASSWORD: ${WEBPASSWORD}
      TZ: 'Europe/Berlin'
      DNS1: 127.0.0.1#5335 # Hardcoded to our Unbound server
      DNS2: 127.0.0.1#5335 # Hardcoded to our Unbound server

    volumes:
      - './etc-pihole:/etc/pihole'
      - './etc-dnsmasq.d:/etc/dnsmasq.d'
    dns:
      - '127.0.0.1'
      - '1.1.1.1'
    network_mode: host
    restart: unless-stopped
  unbound:
    image: klutchell/unbound:1.13.2
    ports:
      - '5053:5053/tcp'
      - '5053:5053/udp'
    restart: unless-stopped

Läuft dann dennoch alles rund oder könnte ich Probleme mit den Ports nun kriegen?

Auch komisch, dass pihole/pihole:latest irgendwie nicht die aktuellsten Versionen zieht:
grafik

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.