IPv6 in docker container and localhost problem

Hello,

Docker is running on my Raspberry Pi. I have a problem with two environment variables ServerIPv6 and localhost dns.

Here is my Docker compose file:

version: "3"

More info at GitHub - pi-hole/docker-pi-hole: Pi-hole in a docker container and https://docs.pi-h$

services:
pihole:
container_name: pihole
image: pihole/pihole:latest
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp"
- "80:80/tcp"
- "443:443/tcp"
environment:
ServerIP: 192.168.0.26
TZ: 'Europe/Berlin'
# WEBPASSWORD: 'set a secure password here or it will be random'
# Volumes store your data between container upgrades
volumes:
- '/home/pi/docker/pihole/etc-pihole/:/etc/pihole/'
- '/home/pi/docker/pihole/etc-dnsmasq.d/:/etc/dnsmasq.d/'
dns:
- 127.0.0.1
- 1.1.1.1
# Recommended but not required (DHCP needs NET_ADMIN)
# GitHub - pi-hole/docker-pi-hole: Pi-hole in a docker container
cap_add:
- NET_ADMIN
restart: unless-stopped

At first I run the compose file without the IPv6 ServerIP. After docker-compose up I got the following errors:

pihole | WARNING Misconfigured DNS in /etc/resolv.conf: Two DNS servers are recommended, 127.0.0.1 and any backup server
pihole | WARNING Misconfigured DNS in /etc/resolv.conf: Primary DNS should be 127.0.0.1 (found 127.0.0.11)
pihole |
pihole | nameserver 127.0.0.11

I do not understand where the IP address 127.0.0.11 comes from, but I could fix the problem by editing the resolve.conf file in the container.

sudo docker exec -i -t c4b0b6b8bf38 /bin/bash #by ID
sudo nano /etc/resolv.conf
pihole -g

With the instructions on the following internet page I have also enabled IPv6.

https://adminforge.de/dns/pi-hole-ipv6-und-die-fritzbox/

Upstream-DNS-Servers

My problem is that unfortunately all changes are gone after a restart and if I add the IPv6 server to my Docker compose file then I get a lot of error messages. If needed I can reproduce the error message. Please help me to fix the problem.

Best regards
Twinsen

Hi, I have just come across your post when searching to resolve my own problems with IPv6 on Pihole in a Docker container.
These three posts may help you create an IPv6 enabled Docker Container for Pihole

These are not related to PiHole specifically but I have managed to get a PiHole container running with a IPv6 address. Still more work to do but these posts may help
cheers