Every time I restart my container, pihole creates a random password and does not use the password in my compose file. Each time I have to reboot my server or restart pihole, I have to go in and reset its password.
Is there something I did wrong in my compose file?
version: "3"
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
# For DHCP it is recommended to remove these ports and instead add: network_mode: "host"
#ports:
# - "53:53/tcp"
# - "53:53/udp"
# - "67:67/udp" # Only required if you are using Pi-hole as your DHCP server
# - "80:80/tcp"
network_mode: "host"
environment:
TZ: 'America/New York'
WEBPASSWORD: password
# Volumes store your data between container upgrades
volumes:
- './etc-pihole:/etc/pihole'
- './etc-dnsmasq.d:/etc/dnsmasq.d'
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
cap_add:
# - NET_ADMIN # Required if you are using Pi-hole as your DHCP server, else not needed
restart: unless-stopped
This is because you have a mix of : and = delimited variables in the yaml, and single quotes around just the right hand of the delimiter and not the entire line.
If you run docker container exec pihole bash -c 'env' you'll get a dump of all the environmen and variables set inside the container.